You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "yong yang (JIRA)" <ji...@apache.org> on 2008/05/21 16:23:55 UTC

[jira] Created: (AXIS2C-1150) memory leak

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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-1150) memory leak

Posted by "yong yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yong yang updated AXIS2C-1150:
------------------------------

    Attachment: http_transport_utils.c

> 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
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-1150) memory leak

Posted by "Milinda Lakmal Pathirage (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12599028#action_12599028 ] 

Milinda Lakmal Pathirage commented on AXIS2C-1150:
--------------------------------------------------

Hi yong,
Adding following things before returning soap_envelope caused invalid reads when I checked using valgrind.
 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); 

Now the correct fix is available in SVN trunk.

Please look at the following link for the fixes I have done recently.

http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c?view=diff&r1=659114&r2=659115&pathrev=659115

And feel free to comment about those fixes and memory leaks.

> 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
>            Assignee: Milinda Lakmal Pathirage
>             Fix For: 1.4.0
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-1150) memory leak

Posted by "Milinda Lakmal Pathirage (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598909#action_12598909 ] 

Milinda Lakmal Pathirage commented on AXIS2C-1150:
--------------------------------------------------

I checked above fixes, but some of them caused Invalid Reads when checked using Valgrind. 

> 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
>            Assignee: Milinda Lakmal Pathirage
>             Fix For: 1.4.0
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Resolved: (AXIS2C-1150) memory leak

Posted by "Milinda Lakmal Pathirage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milinda Lakmal Pathirage resolved AXIS2C-1150.
----------------------------------------------

    Resolution: Fixed

The above memory leaks reported are now fixed in current svn head. Thanks yong yang for pointing those leaks.

> 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
>            Assignee: Milinda Lakmal Pathirage
>             Fix For: 1.4.0
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-1150) memory leak

Posted by "yong yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yong yang updated AXIS2C-1150:
------------------------------

    Attachment: http_client.c

> 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
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-1150) memory leak

Posted by "yong yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yong yang updated AXIS2C-1150:
------------------------------

    Attachment: mime_parser.c

> 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
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-1150) memory leak

Posted by "yong yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yong yang updated AXIS2C-1150:
------------------------------

    Attachment: options.c

> 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
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Assigned: (AXIS2C-1150) memory leak

Posted by "Milinda Lakmal Pathirage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milinda Lakmal Pathirage reassigned AXIS2C-1150:
------------------------------------------------

    Assignee: Milinda Lakmal Pathirage

> 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
>            Assignee: Milinda Lakmal Pathirage
>             Fix For: 1.4.0
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-1150) memory leak

Posted by "yong yang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598957#action_12598957 ] 

yong yang commented on AXIS2C-1150:
-----------------------------------

hi Milinda, may I know which fix caused invalid read? thanks.

> 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
>            Assignee: Milinda Lakmal Pathirage
>             Fix For: 1.4.0
>
>         Attachments: http_client.c, http_transport_utils.c, mime_parser.c, options.c
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org