axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <sam...@wso2.com>
Subject Re: [AXIS2C] memory management
Date Tue, 19 Jun 2007 05:51:31 GMT
Shailesh Srivastava wrote:
> Once the response string is formed, you need to free the local memory
> allocated to "retVal".
>   
If axis2_getStringResponse_set_return method does a deep copy you can 
free retVal. This should ideally be freed by 
axis2_getStringResponse_free method, that is to be called by user.

Samisa...
> -----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
>
>
>   


-- 
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web Services Developers' Portal)


---------------------------------------------------------------------
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