[omniORB] basic parameter passing question
Anthony Shipman
A.Shipman at vorticeresearchgroup.com
Wed Nov 30 19:32:19 GMT 2005
A server of mine has an object reference stored as:
isdn::BChannelControlClient_var ctlObj_;
isdn::BChannelControlClient_var&
BChannel::getControl()
{
return ctlObj_;
}
A method of an interface wants to return this object reference.
isdn::BChannelControlClient_ptr
Service_impl::new_client(...)
{
...
return isdn::BChannelControlClient::_duplicate(bchan->getControl());
}
The Michi+Henning book says that the caller of new_client() is responsible for
releasing the returned object reference. This says to me that I must
duplicate the reference before returning it. Is this correct?
With omniORB 4.0.5 I find that there is a memory leak. I'm told that the leak
goes away if I return the reference like this.
isdn::BChannelControlClient_var retval = bchan->getControl();
return retval._retn();
As far as I can tell this code should be exactly equivalent to the use of
duplicate. Does this make sense to anyone?
--
Anthony Shipman | Mamas don't let your babies
A.Shipman at vorticeresearchgroup.com | grow up to be outsourced.
More information about the omniORB-list
mailing list