Susantha Kumara wrote:
>Hi Alek,
>
>
>
>
hi,
>>-----Original Message-----
>>From: Aleksander Slominski [mailto:aslom@cs.indiana.edu]
>>Sent: Friday, May 28, 2004 10:28 PM
>>To: Apache AXIS C Developers List
>>Subject: memory management and AXIS_DEFINED_ARRAY
>>
>>
>>
>>
>The policies now are,
>1. Any objects passed to skeletons by Axis (created either by Axis
>Engine or wrappers) are not memory managed by Axis. These are
>created/populated/passed to skeletons and it's the responsibility of the
>skeleton to keep it or delete it.
>
>2. Any objects returned by the skeletons will be deleted (deallocated)
>by Axis after they are serialized. So the skeletons should not return
>any objects if they need to keep across several method calls (any
>persistent data).
>
>
>
i read this and your other two emails and i still do not understand it
at all.
correct me if I am wrong but AXIS_DEFINED_ARRAY is struct with int*
pointer inside and i fail to see how it will be automatically deallocated?
>>xsd__int_Array Benchmark1PortType::echoInts(xsd__int_Array Value0)
>>{
>> return Value0;
>>}
>>
>>
>
>Here this is perfectly OK because the skeleton doesn't need to keep the
>passed array.
>
>
>
so no memory leak?
>>and what about returning new value?
>>
>>xsd__int_Array Benchmark1PortType::sendInts(int length)
>>{
>> xsd__int_Array arr;
>> arr.m_Size = length;
>> arr.m_Array = (int *) malloc(length * sizeof(int));
>> // fill in array with values
>> return arr;
>>}
>>
>>
>
>This is OK. But memory inside arr will if be deallocated by Axis Engine
>after serialization.
>
>
>
could you tell me what is the *right* way to implement this method so
there is no memory leak?
>>will it be de-allocated?
>>
>>
>
>Yes
>
>
i will be testing it.
thanks,
alek
--
The best way to predict the future is to invent it - Alan Kay
|