memory leak
-----------

                 Key: AXIS2C-1150
                 URL: https://issues.apache.org/jira/browse/AXIS2C-1150
             Project: Axis2-C
          Issue Type: Bug
          Components: platforms/windows
    Affects Versions: 1.4.0
         Environment: windows platform + axis2c-1.4
            Reporter: yong yang
             Fix For: 1.4.0


Currently the web service client writen with axis2c-1.4 will result in 2763 
bytes memory leak each web service call. I have fixed most of the memory leak. 
I have put some brief descriptions for each memory leak as follows. I also 
attach these source files I modified to fix these memory leak. Could you please 
verify that? 


1)  memory trace report

FNH: ptr deallocated ..\..\util\src\allocator.c: 93

FNH: ptr deallocated ..\..\util\src\allocator.c: 93

FNH: ptr deallocated ..\..\util\src\allocator.c: 93

 

Final Report

MLK: 00CA5E00 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA6040 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA60D0 17 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA65B8 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA6648 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA66D8 42 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA6780 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00CA6810 9 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81468 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E814F8 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81588 42 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81630 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E816C0 4 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81740 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E817D0 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81860 33 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81900 16 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E81990 4 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E86EA8 20 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E88C28 53 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E89DF0 271 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E89F80 44 bytes allocated ..\..\util\src\allocator.c: 76

MLK: 00E88E18 2048 bytes allocated ..\..\util\src\allocator.c: 76

Total allocations    : 2856

Max memory allocation: 1120765 (1094K)

Total leak           : 2763

2) solution

2.1) 2048 bytes

Reason: the memories allocated for callback_ctx->in_stream and 
callback_ctx->chunked_stream are not de-allocated

Solution: 1) modified source file:  
src\core\transport\http\util\http_transport_utils.c

2) Function: axis2_http_transport_utils_create_soap_msg

3) Here I added the following codes just before "return soap_envelope;"

//free the memeory

       if(callback_ctx->in_stream)

              axutil_stream_free(callback_ctx->in_stream, env);

       if(callback_ctx->chunked_stream)

              axutil_http_chunked_stream_free(callback_ctx->chunked_stream, 
env);



2.2) 271 bytes

Reason: the memory allocated for mime_parser->soap_body_str was not de-allocated

Solution:

1)modified source file name: axiom\src\attachments\mime_parser.c

2)modified Function: axiom_mime_parser_free

3) explicitly free the memory. Here I added the following codes just before 
"mime_parser->soap_body_str = NULL;"

//free the soap body string

         if(mime_parser->soap_body_str)

 AXIS2_FREE(env->allocator, mime_parser->soap_body_str);



2.3)53 bytes

Reason: the memory allocated for the mime_boundary are not de-allocated

Solution:

1) modified source file: src\core\transport\http\util\http_transport_utils.c

2) modified Function: axis2_http_transport_utils_process_http_post_request

3) I added the following code at the end of "if (mime_boundary)" statement

     //free mime boudry

                           AXIS2_FREE(env->allocator, mime_boundary);



2.4) 44 bytes

Reason: the memory allocated for http_client->data_stream is not de-allocated.

Solution:

1)modified source file : src\core\transport\http\sender\http_client.c

2)modified function: axis2_http_client_free

3) I added the following codes

//free data stream

    if(http_client->data_stream)

    {

        axutil_stream_free(http_client->data_stream, env);

    }



2.5).     17 bytes

Reason: axis2 set the options->soap_action using 
axutil_string_clone(soap_action, env). Therefore the value of 
options->soap_action-> ref_count will be 2. When calling axutil_string_free 
function in the axis2_options_free function, the memory for 
options->soap_action will not be de-allocated as the value of ref_count is 1.

Solution:

1)modified source file: src\core\clientapi\options.c

2)modified function: axis2_options_set_soap_action

3) I changed the following code in axis2_options_set_soap_action function

from

       if (soap_action)

       {

        options->soap_action = axutil_string_clone(soap_action, env);

}

To

      if (soap_action)

    {

         options->soap_action = soap_action;

    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to