Once the response string is formed, you need to free the local memory
allocated to "retVal".

-----Original Message-----
From: Dr. Florian Steinborn [mailto:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to