“server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

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

Moderator: uasdkcpp

Post Reply
Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

“server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

Post by Antoni Raj »

Hi Support Team,
We are using Unified Automation UA SDK C++ Server Professional 1.6.3 in our OPC UA server. We use visual studio 2015 for our development.
We are following sample server “server_com_da_migration” for our OPC server development.
We have our own NodeManager implementation.


If we connect to UaExpert performance view with “server_com_da_migration” sample application , we can see the steady increase in the memory.I have run the performance test just 30 minutes. There is a very huge memory increase. Just selected the "Write" alone in the UaExpert with 6 nodes.

We tried using separate group m_pReadWriteGroup for Read/Write . Please see the code snippet below.
Still we see memory increase.

void OPCUAIOManagerJob::executeWrite()
{
//TODO: Verify with next version that this is how the WRITE should work

HRESULT hr = S_OK;
OpcUa_UInt32 count = m_pTransactionContext->m_nAsyncCount;
OpcUa_UInt32 i;

OPCHANDLE* pServerHandles = (OPCHANDLE*)CoTaskMemAlloc(count*sizeof(OPCHANDLE));
VARIANT* pValues = (VARIANT*)CoTaskMemAlloc(count*sizeof(VARIANT));
HRESULT* pErrors = NULL;

for ( i=0; i<count; i++)
{
pServerHandles = m_pTransactionContext->m_arrUaVariableHandles->m_serverHandle;
pValues = VARIANT(UaVariant(m_pTransactionContext->m_arrWriteValues->Value));
}


hr = m_pTransactionContext->m_pReadWriteGroup->Write(
count,
pServerHandles,
pValues,
&pErrors);

----
---
---

removeItems(pServerHandles, count);
}

Any help on this would be appreciated.

Thanks
Antoni

Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Re: “server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

Post by Antoni Raj »

Team,
Do you have any update on this?

Thanks
Antoni

User avatar
uasdkcpp
Jr. Member
Jr. Member
Posts: 4
Joined: 04 Jun 2020, 16:23

Re: “server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

Post by uasdkcpp »

Hello Antoni,

yes there is an issue in the server_com_da_migration example. Thank you for pointing us there.
We will fix the example for a future release.
The issue is that the ComDaGroupSample::AddItems() keeps adding for each operation instead of checking if an item was added already before. This causes the ComDaGroupSample::m_mapItems to grow bigger and bigger.
Note:
There is no issue in the SDK. No other examples or applications are affected.
Best regards
Unified Automation Support Team

Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Re: “server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

Post by Antoni Raj »

Hi Support Team,
Thanks for the reply . Appreciate it.

One more question , we get different handle from Uastack for same item added again in the map m_mapItems .
So we need to remove the existing item and add the same item with new handle . Is this correct?


Or

Do we have any way to have the same handle when the same item is added in the m_mapItems again? Please give suggestion on this.


Thanks
Antoni

Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Re: “server_com_da_migration” sample server leaks memory when connected to UaExpert Performance view

Post by Antoni Raj »

Dear Team,
Do we have any update on this?

Thanks
Antoni

Post Reply