possible memory leak on write operation

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

Moderator: uasdknet

Post Reply
Ottilie
Jr. Member
Jr. Member
Posts: 1
Joined: 20 May 2019, 15:28

possible memory leak on write operation

Post by Ottilie »

hi,

in our company we use unified automation to write data. In the program, sessions are first created, then each attached a subscription and then created a list of nodes, which is passed with

Code: Select all

 Results = _Session.Write(NodesToWrite)
So far everything works well. But now a big problem has arisen: The required storage space is constantly increasing.



That's why I use .NETMemoryProfiler to find the cause. I noticed that every 45 minutes the LiveInstances and LiveBytes increase by a fixed amount. If I continue to follow the problem, I find that the UnifiedAutomation.UaBase.TcpChannel.WriteOperation has increased from 33 to 1144 within about three days. This is very much, because our software runs without shutdown for months / years.


The sessions and subscriptions have not changed their instance numbers, they have remained as they should. Now, as I follow a session, it has two instances of TcpChannel.WriteOperation, both contained in the Dictionary <uint, TcpChannel.WriteOperation>. This dictionary collects references to the instances of the WriteOperation and it grows tremendously over time. The write operations are quite common and usually two references are added to the Dictionary for each event and then removed, so it should be. But from time to time an additional reference comes to it and this probably just continues to exist, so that the dictionary grows from first
5 of 7 slots in use
to
105 of 197 slots in use
and more.


If I look at the instance details of the WriteOperation, I notice that in the case of the correctly executed operations on the FieldValues, m_timer has values, which supplies some variables, also m_cancelled. For the WriteOperation remaining in the dictionary, m_timer = null. Similarly, there are differences in the calling order.


Subscription leads to a similar dictionary, but there are no problems there.


Subscription leads to a similar dictionary, but there are no problems there.

Yours sincerely

Ottilie

Post Reply