[AWS] memory leak in AWS-based application

Petr Holub hopet at ics.muni.cz
Thu Jan 8 10:39:59 CET 2009


Dear Pascal,

> No. One question which compiler and AWS versions do you use? On which
> OS? If you are running GNU/Linux valgrind could help you find the memory
> leak. We have found a memory leak when using aggregates without name
> association in GNAT, some workarounds have been put in place in AWS in
> Aug 2008.

sure, here are the details including simple valgrind run with client doing
tens of calls to the server. The leak that builds up over time is the one
denoted as 4/4 in the log below (resulting in 390kB leak at the end of
this run).

Thanks a lot,
Petr


Ubuntu 8.04.1
kernel 2.6.24-22-generic

GNAT 2008
AWS-gpl-2.5.0w
xmlada-gpl-3.1

valgrind --leak-check=full --show-reachable=yes ./slartibartfast_server

==11047== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 1)
==11047== malloc/free: in use at exit: 472,037 bytes in 16,715 blocks.
==11047== malloc/free: 721,400 allocs, 704,685 frees, 50,983,209 bytes allocated.
==11047== For counts of detected errors, rerun with: -v
==11047== searching for pointers to 16,715 not-freed blocks.
==11047== checked 874,904 bytes.
==11047==
==11047== 8,448 bytes in 2 blocks are still reachable in loss record 1 of 4
==11047==    at 0x4C23082: realloc (vg_replace_malloc.c:429)
==11047==    by 0x4E8DD9F: CRYPTO_realloc (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EE7B42: lh_insert (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB8DD: (within /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB404: ERR_load_strings (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB9CE: ERR_load_crypto_strings (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x51D8078: SSL_load_error_strings (in /usr/lib/libssl.so.0.9.8)
==11047==    by 0x5527616: aws__net__ssl___elabb (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x40C26F: adainit (b~slartibartfast_server.adb:519)
==11047==    by 0x40C4E4: main (b~slartibartfast_server.adb:634)
==11047==
==11047==
==11047== 24,149 bytes in 67 blocks are still reachable in loss record 2 of 4
==11047==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==11047==    by 0x65C297A: __gnat_malloc (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x65CAD42: __gnat_new_socket_set (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x6554B8A: gnat__sockets__thin___elabb (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x40BE14: adainit (b~slartibartfast_server.adb:336)
==11047==    by 0x40C4E4: main (b~slartibartfast_server.adb:634)
==11047==
==11047==
==11047== 48,512 bytes in 1,996 blocks are still reachable in loss record 3 of 4
==11047==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==11047==    by 0x4E8DCE2: CRYPTO_malloc (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EE77D1: lh_new (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EE9E56: (within /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB8AF: (within /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB193: ERR_load_ERR_strings (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x4EEB978: ERR_load_crypto_strings (in /usr/lib/libcrypto.so.0.9.8)
==11047==    by 0x51D8078: SSL_load_error_strings (in /usr/lib/libssl.so.0.9.8)
==11047==    by 0x5527616: aws__net__ssl___elabb (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x40C26F: adainit (b~slartibartfast_server.adb:519)
==11047==    by 0x40C4E4: main (b~slartibartfast_server.adb:634)
==11047==
==11047==
==11047== 390,928 bytes in 14,650 blocks are definitely lost in loss record 4 of 4
==11047==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==11047==    by 0x65C297A: __gnat_malloc (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x649CB0F: ada__strings__unbounded__adjust__2 (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x649CDFD: ada__strings__unbounded__to_unbounded_string (in
/home/hopet/gnat-2008/lib/gcc/x86_64-pc-linux-gnu/4.1.3/rts-native/adalib/libgnat-6.2.so)
==11047==    by 0x564ADEF: soap__name_space__create (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x54D4370: soap__message__xml__parse_namespaces (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x54D7E66: soap__message__xml__parse_body (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x54D8BB0: soap__message__xml__parse_document (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x54D9001: soap__message__xml__load_payload (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==    by 0x444694: slartibartfast_server_cb__soap_addhosts_wrapper (soap-utils.adb:288)
==11047==    by 0x44977B: slartibartfast_server_cb__aws_callback (slartibartfast_server_cb.adb:183)
==11047==    by 0x557408A: aws__server__http_utils__answer_to_client (in /home/hopet/gnat-2008/lib/aws/relocatable/libaws.so)
==11047==
==11047== LEAK SUMMARY:
==11047==    definitely lost: 390,928 bytes in 14,650 blocks.
==11047==      possibly lost: 0 bytes in 0 blocks.
==11047==    still reachable: 81,109 bytes in 2,065 blocks.
==11047==         suppressed: 0 bytes in 0 blocks.

================================================================
                           Petr Holub
CESNET z.s.p.o.                       Supercomputing Center Brno
Zikova 4                             Institute of Compt. Science
162 00 Praha 6, CZ                            Masaryk University
Czech Republic                     Botanicka 68a, 60200 Brno, CZ 
e-mail: Petr.Holub at cesnet.cz               phone: +420-549493944
                                             fax: +420-541212747
                                       e-mail: hopet at ics.muni.cz


> -----Original Message-----
> From: Pascal Obry [mailto:pascal at obry.net]
> Sent: Thursday, January 08, 2009 8:34 AM
> To: Petr Holub
> Cc: aws at LISTS.EU.adacore.com
> Subject: Re: [AWS] memory leak in AWS-based application
> 
> Petr,
> 
> > Any experiences with this? (Just want to avoid discovering a wheel ;) ).
> 
> 
> There is a memory leak detector test in AWS test suite. It probably does
> not cover all part of the code but is clean since long time.
> 
> Pascal.
> 
> --
> 
> --|------------------------------------------------------
> --| Pascal Obry                           Team-Ada Member
> --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
> --|------------------------------------------------------
> --|              http://www.obry.net
> --| "The best way to travel is by means of imagination"
> --|
> --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



More information about the AWS mailing list