Skip to main content

Problem:

  • Product Name: VisiBroker for C
  • Product Version: ALL
  • Product Component: ORB
  • Platform: ALL

Why is there a memory leak in deactivate_object() call? Relevant code segment:
TSession_POA->deactivate_object(*(TSession_POA->reference_to_id(poClntSess->m_pClientSession)));

Resolution:

The problem happens when deactivate_object() and reference_to_id() calls are made on the same line.
The memory leak happens because the reference returned by reference_to_id() call is not freed by anyone.
Breaking them up will resolve the problem:
Change this:

TSession_POA->deactivate_object(*(TSession_POA->reference_to_id(poClntSess->m_pClientSession)));

To this:

PortableServer::ObjectId_var objID=TSession_POA->reference_to_id(poClntSess->m_pClientSession);
TSession_POA->deactivate_object(objID.in());


#VisiBroker
#Security