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 09:19:59 GMT
Dr. Florian Steinborn wrote:
> Thanks for the answers - unfortunately it raises more questions...
>
> 1. "deep copy" - should this mean to really copy something (by 
> allocating new memory) and not just let a pointer to point to a 
> certain piece of memory?
Yes.
>
> 2. The function axis2_getStringResponse_set_return() is generated. The 
> generated function can be seen here.
>
> /**
>   * setter for return
> */
> axis2_status_t AXIS2_CALL
> axis2_getStringResponse_set_return(
>        axis2_getStringResponse_t* getStringResponse,
>        const axutil_env_t *env,
>        axis2_char_t*  param_return)
> {
>
>   AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>   if(!getStringResponse)
>   {
>       return AXIS2_FAILURE;
>   }
>   getStringResponse-> attrib_return = param_return;
>   return AXIS2_SUCCESS;
> }
>
> The assignment of param_return does not look like a "deep copy", right? 
Yes it is a shallow copy.
> As far as I understood, the only files that have to be touched after 
> generation are the axis2_skel_<SERVICE>.c files for the business logic...
>
> 3. Do I understand correctly, nobody else frees the memory if not the 
> user does it? Cannot imagine that - all the generated services would 
> be giantic memory holes...
The model is that the user got to free it. The notion of "user got to 
free it" makes sense, as the user has control over the lifetime of the 
struct instance.
>
>
> 4. Does someone have a reference implementation of a "deep copy" to 
> look at?
The generated code is correct. What you have to do is to manage the 
memory in the business logic implementation.
In case of code generation, what can be done is to have a free method 
for axis2_getStringResponse_t struct. Then once you call 
axis2_skel_<servicename>_getString method, get the 
axis2_getStringResponse_t instance and use it, free the 
axis2_getStringResponse_t instance, which would free the members of the 
axis2_getStringResponse_t struct.

Samisa...

>
> Thanks,
> Flori
>
>
> On Tue, 19 Jun 2007 07:51:31 +0200, Samisa Abeysinghe 
> <samisa@wso2.com> wrote:
>
>> 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...
>
> [...]
>
> ---------------------------------------------------------------------
> 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