[omniORB] omniORB 4.0.3 client side memory leak?
Jochen Behrens
jochen.behrens at barco.com
Tue Feb 24 13:00:25 GMT 2004
Hi Mike,
I think it's not a bug. Out parameters always must be initialized on
server side. This is especially necessary for all kind of
variable-length parameters. If you do not allocate memory and
initialize the output string on server-side, the underlying ORB trys to
marshall the string at the uninitialized position and runs into the
observed problem (COMM_FAILURE). On client side the proxy allocates
memory while unmarshalling the request results. Hence, the caller is
responsible to deallocate it.
Jochen
Mike Bendickson wrote:
> In porting some code from omniORB 2.8.0 to 4.0.3, my client is getting
> exceptions and leaking memory.
>
> Here is the offending code:
>
> IDL:
>
> .
> .
> .
> short test_outStrParamNotReturned(out string p_sTestOut);
> .
> .
> .
>
> The server impl looks something like this:
>
> CORBA::Short
> #if defined(_USE_OMNIORB280)
> CIOmniORBImpl::test_outStrParamNotReturned(char *& p_sTestOut)
> #elif defined(_USE_OMNIORB403)
> CIOmniORBImpl::test_outStrParamNotReturned(CORBA::String_out p_sTestOut)
> #endif
> {
> std::cout << "Executing test_outStrParamNotReturned(...)" <<
> std::endl;
> // p_sTestOut = CORBA::string_dup("test_outStrParamNotReturned");
> return (0);
> }
>
> Note that string_dup is commented out. With 2.8, no client exception
> is thrown, and no leak is apparent.
>
> In 4.0.3, I get a COMM_FAILURE exception, and it leaks memory (client
> side leak).
>
> It's easily fixed by making sure that I always initialize the output
> string, but it seems like it might be a bug so I thought I'd report it.
>
> -Mike
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> - - - - - - - DISCLAIMER - - - - - - - -
> Unless indicated otherwise, the information contained in this message
> is privileged and confidential, and is intended only for the use of
> the addressee(s) named above and others who have been specifically
> authorized to receive it. If you are not the intended recipient, you
> are hereby notified that any dissemination, distribution or copying of
> this message and/or attachments is strictly prohibited. The company
> accepts no liability for any damage caused by any virus transmitted by
> this email. Furthermore, the company does not warrant a proper and
> complete transmission of this information, nor does it accept
> liability for any delays. If you have received this message in error,
> please contact the sender and delete the message. Thank you.
>
--
-----------------------------------
Jochen Behrens
Software Engineer
Barco Orthogon AG
Hastedter Osterdeich 222
28207 Bremen
Tel +49-421-20122-447
Fax +49-421-20122-999
www.barco-orthogon.com
Jochen.Behrens at barco.com
More information about the omniORB-list
mailing list