axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shailesh Srivastava" <shailesh.srivast...@ttec.soc-soft.com>
Subject RE: [AXIS2C] memory management
Date Tue, 19 Jun 2007 03:52:04 GMT
Once the response string is formed, you need to free the local memory
allocated to "retVal".

-----Original Message-----
From: Dr. Florian Steinborn [mailto:florian.steinborn@drb.insel.de] 
Sent: Monday, June 18, 2007 6:47 PM
To: axis-c-user@ws.apache.org
Subject: [AXIS2C] memory management

Hi friends,

just a "simple" question...
When you define a webservice that has an operation that returns a
string,  
you probably will get a generated function similiar to this:

/* starts here */

axis2_getStringResponse_t*
axis2_skel_<servicename>_getString ( const axutil_env_t *env  ,
                                 axis2_getString_t* getString )
{
     axis2_getStringResponse_t*  getStringRes = NULL;
     axis2_char_t*               retVal = NULL ;

     retVal = (axis2_char_t*) malloc( sizeof(char) * 20);
     strncpy( retVal, "NONSENS", 20);



     getStringRes = axis2_getStringResponse_create( env);
     axis2_getStringResponse_set_return( getStringRes, env, retVal) ;

     return getStringRes;

}

/* ends here */

The big question is: who cares for the memory allocated in "retVal" ? Do
I  
have to free it or is it freed automatically by the Axis2 machine after

serializing the answer? A small string may not be interesting but when
you  
have to fill structs or arrays of structs... ?

Thanks,

Flori

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Mime
View raw message