[omniORB] problem with server memory deallocation
risc risc
riscman77 at gmail.com
Mon Apr 12 13:03:45 BST 2010
Hi Luke,
thanks for your reply and support. Yes i understand the concept thanks, but
i have tryed to add e remove reference after the object Activation POA
with
test_p1_i * n=new test_p1_i;
n->name("Alex");
test::p1_var ret=n->_this();
n->remove_ref();
return ret._retn();
in the client:
test::p1_var l=login->function();
l->nome();
orb->destroy();
also if i make :
test::p1_ptr l=login->function();
l->nome();
CORBA::release(l);
orb->destroy();
the object allocated from server is not be deallocated. however if in the
server add another one n->_remove_ref();
it be deallocated before return to client.
seem for the passing the object to client is added the reference another
one... :(
maybe i had mistake in client caller?
Thanks
Regard
R!SC
2010/4/12 Luke Deller <ldeller at iress.com.au>
> 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.
>
> **********************************************************************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20100412/089099fb/attachment.htm
More information about the omniORB-list
mailing list