axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shiraz Muthalif" <>
Subject Memory Allocation - Issues
Date Sat, 24 Jul 2004 09:52:01 GMT
Hi All,

I wish inform the Axis C++ community that I have been trying to replace
the memory allocation mechanism from C++ style to C style on the client
side code and any tool generated code however it has not been possible as
even though the code compiles the samples tend to fail. I came up with 2
reasons why this can not be done at the present time.

      • AS C++ is and object oriented language and supports concepts like
destructors and constructors the C programming language not being
object oriented does not support them. Therefore when we de-allocate
memory allocated by C++ code using C style “free” memory
de-allocation mechanism the destructors are not called.

The solution for the above problem might be to completely change the
memory allocation mechanism to C++ style memory allocation mechanism.
However there seems to be issues when we try to go for this solution.

      • When an array is de-serialized it uses C style memory allocation
mechanism in the present code and needs a memory “re-allocation”
mechanism for this purpose, C++ does not support “realloc” and if we
use “new” instead we have to allocate fresh memory blocks each time
we need to increase the array size. This can be more expensive than
using "realloc".

Hope this information is useful. Please feel free to send your comments or
suggestions regarding this issue.

Thanks and regards,


View raw message