Possible Memory Leak

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
MartinLentzsch
Jr. Member
Jr. Member
Posts: 4
Joined: 24 Jan 2017, 16:20

Possible Memory Leak

Post by MartinLentzsch »

Hallo,

I have a problem with a sync read of an opc machine. Every call to my read function will reserve memory and will not be released.

Main function is :

Code: Select all

 
public int Maschinenzaehler;
public int Gutteile;

var nodesToRead = new ReadValueIdCollection
{
  new ReadValueId
  {
    NodeId = new NodeId(117562, _namespaceId),
    AttributeId = Attributes.Value
  },
  new ReadValueId
  {
    NodeId = new NodeId(239002, _namespaceId),
    AttributeId = Attributes.Value
  }
};
List<DataValue> results = Session.Read(nodesToRead);
if ((StatusCode.IsGood(results[0].StatusCode) &&
  (Convert.ToInt32(results[0].WrappedValue.ToString()) > 0)))
    Maschinenzaehler = Convert.ToInt32(results[0].WrappedValue.ToString());
if ((StatusCode.IsGood(results[1].StatusCode) &&
  (Convert.ToInt32(results[1].WrappedValue.ToString()) > 0)))
    Gutteile = Convert.ToInt32(results[1].WrappedValue.ToString());

nodesToRead.Clear();
results.Clear();
Can anybody help me?

Thanks
Martin

User avatar
Support Team
Hero Member
Hero Member
Posts: 3069
Joined: 18 Mar 2011, 15:09

Re: Possible Memory Leak

Post by Support Team »

Hello Martin,

The OPC UA Client SDK does not create a memory leak by your code.
.NET garbage collector will do the job later. You may just need to give .NET a chance (more time) to clean up.
Best regards
Unified Automation Support Team

SommerPatrik
Jr. Member
Jr. Member
Posts: 1
Joined: 13 Oct 2017, 12:44

Re: Possible Memory Leak

Post by SommerPatrik »

Hallo


I have the same problem , with multiple session on one client.

After session.close and recreate the memory is aloc.
For the test we used a subscription with 50 item.

After 100 open/close / new session() the app has over 700 mb.

In the memlog are only unified objects.

If you has any idea ?

Mfg patrik

Post Reply