[omniORB] Request for assistance with server side memory leak
(omniORB 4.1.3)
Brian Neal
bgneal at gmail.com
Mon May 31 19:20:00 BST 2010
2010/5/31 Mark Ferguson <markfer at xtra.co.nz>:
> Hi,
> We are seeking advise on how to resolve a server-side memory leak with
> omniORB 4..1.3
> Symptom observed:
> - The response buffer allocated by the server is never freed
>
> Seaking advise on:
> - What we need to change to ensure that the server does not leak memory
>
> Summary of software used:
>
> - Client (1) implementation omniORB 2.8 (win32)
> - Client (2) implementation omniORB 4.1.3 (AIX 5.3)
> - Server implementation omniORB 4.1.3 (AIX 5.3)
> Note: Changing the win32 client implementation is not an option at this
> stage.
>
>
> IDL Summary:
> Service.idl
> long getChildrenList(in string req_data,
> in long req_data_len,
> out string response_data,
> out long response_data_len)
> raises (EInternalError, EGetChildrnListFailed);
> ServiceSK.cc
> ::CORBA::Long _objref_Service::getChildrenList(const char* req_data,
> ::CORBA::Long req_data_len, ::CORBA::String_out response_data,
> ::CORBA::Long& response_data_len)
>
>
[..]
>
> Server side summary:
> Service_i.cpp
> CORBA::Long Service_i::getChildrenList (const char *req_data,
> CORBA::Long req_data_len,
> CORBA::String_out response_data,
> CORBA::Long &response_data_len)
> {
> ...
> CORBA::Long ret = serverImplGetChildrenList(req_data, req_data_len,
> response_data, response_data_len, resv );
> ...
> }
> ServerImpl.cpp
> int serverImplGetChildrenList( const char * request_data,
> long request_data_len,
> char * & response_data, // should this be
> CORBA::String_var & response_data, or is there more required?
> long & response_data_len,
> char* reserved)
> {
> ...
> // allocate memory for the response on the heap
> response_data = new char [1024000];
> // populate the response buffer with data
> ...
> return SUCCESS;
> }
>
The first suggestion that pops into my head:
response_data is a CORBA::String_out. You should allocate the memory
with CORBA::string_alloc() because the skeleton code will deallocate
with CORBA::string_free() (and not delete []).
Regards,
BN
More information about the omniORB-list
mailing list