< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] Memory Leak and Encoding in Contents Fixed. More help needed.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

        

All (Especially David);

I have fixed two problems with Contents today:

1) Multiple ContentLanguage Tokens were output (revision 2968) as:

        Content-Languages: en_CA
        fr_CA

intead of :

        Content-Languages: en_CA, fr_CA

2) The Contents::operator=(const Contents&) member would clobber all the ContentsHeaders.

Repository revision 2968 contains my fixes.

Repository revision 2966 contains the testPlainContents update that includes a leak check -- but so does the latest, so just roll Contents.cxx around if you want to play with valgrind.


I'm still getting a report from valgrind that my testPlainContents leaks in setContentsHeaders() but lack the time / familiarity with the code to track down what it is that's leaking and how to fix it. My suspicion is that the assignment operator on a MultiHeader of Tokens (the Content-Languages header) isn't deleting the lhs of the expression but I'm at a complete loss to find this.

It is the last leak at the bottom of this email that still concerns me. All the other output from valgrind shows that the memory is associated with static objects.

Pointers or torch bearers?

Alan

If anyone wants the valgrind output from the leak, (original and now) here are the relevant leaks:

Revision 2967 of Contents.cxx:
alan@tupolev test $ valgrind --show-reachable=yes --leak-check=yes - --leak-resolution=high --num-callers=10 ./testPlainContents
[snip]
==25608== 1200 bytes in 100 blocks are definitely lost in loss record 5 of 10
==25608==    at 0x40028B51: __builtin_new (vg_replace_malloc.c:172)
==25608== by 0x40028BBC: operator new(unsigned) (vg_replace_malloc.c:185) ==25608== by 0x805E5BB: resip::Contents::header(resip::H_ContentLanguages const&) const (Contents.cxx:295) ==25608== by 0x80532A8: setContentsHeaders(resip::Contents&) (../../resiprocate/ParserContainer.hxx:91)
==25608==
==25608== 18800 bytes in 100 blocks are possibly lost in loss record 7 of 10
==25608==    at 0x40028B51: __builtin_new (vg_replace_malloc.c:172)
==25608== by 0x40028BBC: operator new(unsigned) (vg_replace_malloc.c:185) ==25608== by 0x805E53B: resip::Contents::header(resip::H_ContentTransferEncoding const&) const (Contents.cxx:284) ==25608== by 0x805322F: setContentsHeaders(resip::Contents&) (testPlainContents.cxx:14)==25608==
==25608==
==25608== 18800 bytes in 100 blocks are possibly lost in loss record 8 of 10
==25608==    at 0x40028B51: __builtin_new (vg_replace_malloc.c:172)
==25608== by 0x40028BBC: operator new(unsigned) (vg_replace_malloc.c:185) ==25608== by 0x805E66B: resip::Contents::header(resip::H_ContentDescription const&) const (Contents.cxx:306) ==25608== by 0x8053200: setContentsHeaders(resip::Contents&) (testPlainContents.cxx:13)==25608==
==25608==
==25608== 18800 bytes in 100 blocks are possibly lost in loss record 9 of 10
==25608==    at 0x40028B51: __builtin_new (vg_replace_malloc.c:172)
==25608== by 0x40028BBC: operator new(unsigned) (vg_replace_malloc.c:185) ==25608== by 0x805E4BB: resip::Contents::header(resip::H_ContentDisposition const&) const (Contents.cxx:273) ==25608== by 0x80531D1: setContentsHeaders(resip::Contents&) (testPlainContents.cxx:12)==25608==

And the latest:
[snip]
==25915== 720 bytes in 1 blocks are still reachable in loss record 7 of 8
==25915==    at 0x40028B51: __builtin_new (vg_replace_malloc.c:172)
==25915== by 0x40028BBC: operator new(unsigned) (vg_replace_malloc.c:185) ==25915== by 0x4042B2C0: std::__new_alloc::allocate(unsigned) (in /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libstdc++.so.5.0.2) ==25915== by 0x4042AE28: std::__default_alloc_template<true, 0>::_S_chunk_alloc(unsigned, int&) (in /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libstdc++.so.5.0.2) ==25915== by 0x4042AC7A: std::__default_alloc_template<true, 0>::_S_refill(unsigned) (in /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libstdc++.so.5.0.2) ==25915== by 0x4042B02D: std::__default_alloc_template<true, 0>::allocate(unsigned) (in /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libstdc++.so.5.0.2) ==25915== by 0x8053325: setContentsHeaders(resip::Contents&) (/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include/g++-v3/bits/ stl_alloc.h:238)
==25915==    by 0x8053708: leakCheck(bool) (testPlainContents.cxx:51)
==25915==    by 0x8053D2A: main (testPlainContents.cxx:89)
==25915==    by 0x404AFDC3: __libc_start_main (in /lib/libc-2.3.1.so)
==25915==
==25915==

a l a n a t j a s o m i d o t c o m
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFAyQ5V2t1B785xGCgRAkFUAJ0T8WczeM6RwrmvRf47ARMAByiUSQCeMQxR
RUTa7bodTN71tboSJNvk0GY=
=cmsW
-----END PGP SIGNATURE-----