Page 1 of 1

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

Posted: 04 Sep 2020, 16:55
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

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

Posted: 10 Sep 2020, 07:38
by Antoni Raj
Team,
Do you have any update on this?

Thanks
Antoni

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

Posted: 11 Sep 2020, 13:28
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.

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

Posted: 16 Sep 2020, 14:31
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

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

Posted: 21 Sep 2020, 06:13
by Antoni Raj
Dear Team,
Do we have any update on this?

Thanks
Antoni