[omniORB] problem with server memory deallocation
Luke Deller
ldeller at iress.com.au
Mon Apr 12 19:57:44 BST 2010
Hi R!SC,
> test::p1_var ret=n->_this();
> return ret._retn();
Your servant object (whose class descends from PortableServer::ServantBase) is reference counted. When you call n->_this() there will be *two* outstanding references to the servant: one held by the POA (because the object has been automatically activated) and another whose ownership is returned to the caller. The first reference will be removed when the object is deactivated (which would happen when you shut down the ORB unless you explicitly deactivate it earlier), but you need to remove the second reference yourself or it will leak as you have observed.
The easiest thing to do here is to call n->_remove_ref() in between the two lines quoted above. This way the object will be deleted when the ORB shuts down.
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