Hello everyone, I had some very basic questions about memory management in Axis2/C and hope I can clarify my doubts with your help. I did go through the article on memory management => http://wso2.org/library/237 but still have some questions.
1. I am working on a new webservice for which I just copied the 'math' service from the samples and have been just modifying it. In the 'add' operation of the 'math' service, there are some calls to axiom_element_get_text function which returns a const axis2_char_t* to retrieve the parameters from the soap xml document. Who is responsible for freeing up this memory? I assume since its const pointer and I didnt explicitly allocate memory, it will be clened up by the framework. But when does this happen? I looked at the math_free function in math_skeleton.c file but it doesn't tell me much. Is this when the clean up happens? int AXIS2_CALL math_free(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env) { if (svc_skeleton) { AXIS2_FREE(env->allocator, svc_skeleton); svc_skeleton = NULL; } return AXIS2_SUCCESS; } 2. Is there any advantage in using the AXIS2_MALLOC over jus malloc? From my understanding, AXIS2_MALLOC just hides the env specific implementation of memory allocation. So if I am using 'C' either malloc or AXIS2_MALLOC are one and the same. Am I correct? On a similar note, is there any advantage in using axis2_char_t* over just char*? I thank all of you for ur help and patience as I try to understand the Axis2 framework. Subra