- Posts: 11
- Thank you received: 0
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
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 !
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.
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.
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 !"
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 .
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, 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;