![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
10/24/2014
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
I got source code for Opc.Ua.Core and Opc.Ua.Client from Siemens's sample application project.
I was using the DLLs for developing our application in C#, and noticed some resource leak after application running some time.
I tracked to two problems, that ClientBase and TcpChannel class, when disposing themselves does not dispose
their disposable member (m_channel and m_socket).
I changed the code Stack/Core/Stack/Tcp/TcpChannel line 137
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// nothing to do.
}
}
to
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (m_socket != null)
{
m_socket.Dispose();
}
}
}
and Stack/Core/Stack/Client/ClientBase.cs line 53
public void Dispose()
{
Dispose(true);
}
public void Dispose()
{
if (m_channel != null)
{
m_channel.Dispose();
}
Dispose(true);
}
And resource leak is eliminated.
Here I saw FAQ about Submitting code, and peeked source on github.
The code for ClientBase was not changed. The file for TcpChannel does not exist any more.
I don't know about newer codebase, so I report here.
Best regards
Mutsumu Nomura
1 Guest(s)