0

I'm working with Axis2C. I'm doing some test with a simple web service client to test this framework.

I wrote the client using some examples and the documentation provided by Apache. The client works fine and I decided to test it with valgrind to make sure the memory management is correct.

I used the functions mentioned in the examples and documentation to free memory (in this particular case) :

// to free the requst struct.
 adb_EncryptRequest_free(request, env);

 // to free the stub.
 axis2_stub_free(stub, env);

 // to free the environment.
 axutil_env_free((axutil_env_t*) env);

I don't have any "wild" new or malloc in the code.

However, valgrind reports the following:

LEAK SUMMARY:
==2287==    definitely lost: 56 bytes in 3 blocks
==2287==    indirectly lost: 156 bytes in 5 blocks
==2287==      possibly lost: 0 bytes in 0 blocks
==2287==    still reachable: 20 bytes in 1 blocks
==2287==         suppressed: 0 bytes in 0 blocks

I rerun Valgind with --leak-check=full, but as I understand the memory issues are located in the axis2c *.so files.

HEAP SUMMARY:
==2292==     in use at exit: 232 bytes in 9 blocks
==2292==   total heap usage: 13,180 allocs, 13,171 frees, 760,422 bytes allocated
==2292== 
==2292== 68 (16 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C5C07: axutil_string_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804E024: axis2_stub_start_op_PoCPCIServiceService_GetEncryptedData (axis2_stub_PoCPCIServiceService.c:493)
==2292==    by 0x804E759: main (main.c:59)
==2292== 
==2292== 72 (20 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C74F5: axutil_qname_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804D515: axis2_stub_populate_services_for_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:91)
==2292==    by 0x804D395: axis2_stub_create_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:48)
==2292==    by 0x804E6ED: main (main.c:46)
==2292== 
==2292== 72 (20 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 9 of 9
==2292==    at 0x400677E: malloc (vg_replace_malloc.c:195)
==2292==    by 0x40C2032: axutil_allocator_malloc_impl (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x40C74F5: axutil_qname_create (in /home/EMBT/Downloads/axis2c-bin-1.6.0-linux/lib/libaxutil.so.0.6.0)
==2292==    by 0x804D64F: axis2_stub_populate_services_for_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:111)
==2292==    by 0x804D395: axis2_stub_create_PoCPCIServiceService (axis2_stub_PoCPCIServiceService.c:48)
==2292==    by 0x804E6ED: main (main.c:46)

If I'm correct, is there a way I can solve it?

Thanks for your help.

Regards.

user1274605
  • 405
  • 2
  • 6
  • 17
  • Unfortunately, Axis2/C is full of memory leaks, at least from the server-side perspective (I didn't write clients with Axis): 1) server-side service code generated from WSDL has leaks; 2) "simple HTTP server" has leaks; 3) CGI module has leaks (which are not an issue as long as it is used as standard CGI, but become critical if you try to reuse the code, or run it inside something like FastCGI). I've posted patches for all the leaks I found/fixed so far to Axis2/C JIRA, but the project is not actively maintained: it takes months to review and commit simple fixes. – vond Jun 17 '12 at 15:36

2 Answers2

0

Without the code its just guessing. I used axis2c (1.7.x from svn) and did not notice any leaks (checked with visual leak detector in vc).

I only freeed the service client and the environment.

 axis2_svc_client_free(svc, env);
 axutil_env_free(env);

According to the header commentar the data you bind with the "axis2_svc_client_send_receive" (which is used inside the generatd code) is freed by the service client.

Marco Kinski
  • 302
  • 3
  • 7
0

Unfortunately Axis2/C has many memory leaks.

We started axis2c-unofficial project to provide most stable build of Axis2/C than original.

There is a list of issues fixed within that project.

loentar
  • 5,111
  • 1
  • 24
  • 25