Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Memory increase by using WMI Service

More
23 Mar 2018 07:04 #6174 by RVersteeg
Hello !

I have tested all variants "Varlear(Results)", "Variantcleart(Results)" and "Varlear(Arguments)", "Variantcleart(Arguments)" and without Clear.

After I Start the cyclic Read of the network State the memory increase 100 kb every second !

Please Log in or Create an account to join the conversation.

More
22 Mar 2018 15:35 #6173 by support
I have quickly reviewed your code (it should be said that I do not know Delphi much). There is one thing that may be incorrect, although I am not 100% sure.

It seems to me that you should be releasing the results that you obtain from QuickOPC operation calls. That would affect 3 places in your code:
  • In TOPCThreadSender.Write, I would put VarClear(Results) after you are done with processing the results.
  • In TOPCThreadReader.Read, I would put VarClear(Results) after you are done with processing the results.
  • In TOPCThreadChange.subscribe, I would put VarClear(HandleArray) after you are done with processing the results.

OleVariant documentation: I have tried to figure out whether OleVariant will itself clear the contained value upon leaving the scope, and it seems that it should, but note that here we assigning the safearray to it in somewhat special way, and therefore I am not sure whether it will work as normally. So, this may not be the cause of the memory increase, but please try it first, before we explore other hypothesis.

Best regards

Please Log in or Create an account to join the conversation.

More
22 Mar 2018 13:58 #6172 by support
OK, if the memory went to such 1.5 GB then it is clear that there is a problem somewhere.
Most likely cause is that there is an unreleased COM interface pointer somewhere in the Delphi code.
I will have a look at it.

I do not quite understand what has the GetNetworks procedure you posted, and the WMI usage, have to do with it.

Please Log in or Create an account to join the conversation.

More
22 Mar 2018 11:11 #6171 by RVersteeg
Hello !

I have already Test our Application over a Weekend !

We write all 60 seconds the private Size, memory asured in a Excel File !

This File shows that the memory increase !

We have open the Resourcemonitor and that shows that the Size in "Zugesichert (KB)" periodic increase !







After the weekend, the Process was 1.5 GBYTE and windows message show "Not enough memory !"
Attachments:

Please Log in or Create an account to join the conversation.

More
22 Mar 2018 09:42 #6170 by support
Hello,

first thing to do is to observe the observe the process memory using PerfMon for a *long time*, and post the graph/data here.

This is necessary because the underlying .NET memory is managed, and what seems as an increase may then fall back to normal after some time. More about this e.g. www.opclabs.com/forum/ua-general/2278-internal-long-running-test-results .

Regards

Please Log in or Create an account to join the conversation.

More
22 Mar 2018 08:14 #6169 by RVersteeg
Hello !

In our application we use WMI Service to get the Network Adapter and Network Connect State !
if I use this code without to start the TEasyUAClient communication the Memory of the Process is O.K.

After start a communication to OPC UA with readmultiplevalues() the memory of the process increase rapidly !


FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  FWMIService := FSWbemLocator.ConnectServer('localhost',
    'root\WMI', '', '');
 
 
procedure GetNetworks;
var
  P: IUnknown;
  OEnum: IEnumvariant;
  iValue: LongWord;
 
  cnt: integer;
  f:cardinal;
  OutBufLen: ULONG;
 
  NumInterfaces: Cardinal;
 
    FWbemObjectSet: OLEVariant;
    FWbemObject: OLEVariant;
    AdapterInfo: array of TIpAdapterInfo;
 
 
    connected: integer;
 
    Instancename: string;
    aktiv: boolean;
 
begin;
  GetNumberOfInterfaces(NumInterfaces);
 
  OutBufLen := NumInterfaces * SizeOf(TIpAdapterInfo);
  try
    GetAdaptersInfo(@AdapterInfo[0], OutBufLen);
    try
      FWbemObject := form2.FWMIService.InstancesOf('MSNdis_MediaConnectStatus');
      try
        P := FWbemObject._NewEnum;
        try
          P.QueryInterface(IEnumvariant, OEnum);
          if FWbemObject.count > 0 then
          begin
            for cnt := 0 to FWbemObject.count - 1 do
            begin
             try
              OEnum.Next(1, FWbemObjectSet, f);
              connected := FWbemObjectSet.NdisMediaConnectStatus;
              aktiv := FWbemObjectSet.Active;
              Instancename := FWbemObjectSet.Instancename;
             finally
              FWbemObjectSet:=unassigned;
             end;
            end;
          end;
        except
 
        end;
      finally
        FWbemObject := Unassigned;
      end;
    except
 
    end;
  except
 
  end;
end;
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.203 seconds