[omniORB] problem with server memory deallocation

Luke Deller ldeller at iress.com.au
Mon Apr 12 20:22:43 BST 2010


Hi R!SC,

Sorry my explanation was not entirely accurate (though the solution was correct).  Here is an amended explanation.
>> test_p1_i * n=new test_p1_i;
TThe above line constructs your servant, whose class is descended from whose class descends from PortableServer::ServantBase which supports reference counting. At this point there is one outstanding reference to the servant.
>> test::p1_var ret=n->_this();
TThe above line will implicitly activate a CORBA object, so now there is a second reference to your servant owned by the POA.  
When you shut down the ORB or explicitly deactivate the object, the POA will release its reference to your servant.  However there is still the original reference outstanding, so the servant will leak as you have observed.

My suggestion is to call n->_remove_ref() immediately after activating the object so that it will be deleted upon deactivation.

Regards,
Luke.
**********************************************************************************************
Important Note
This email (including any attachments) contains information which is confidential and may be subject to legal privilege.  If you are not the intended recipient you must not use, distribute or copy this email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this email are not necessarily the views of IRESS Market Technology Limited.

It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system.
IRESS Market Technology Limited does not warrant that the information is free of a virus or any other defect or error.
**********************************************************************************************


More information about the omniORB-list mailing list