-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello all,

Is the valgrind tool a reliable tool for checking for memory leaks in
perl and in our perl scripts?

I have a perl script that's consuming all the memory available on my
system. I rechecked the script and since i didn't found anything
(algorithm wise) that can cause such memory consuption, I decided to
use valgrind. 

And valgrind is reporting a memory leak. :-(

I'm running it as:

valgrind --log-file=valgrind --trace-children=yes -v
- --show-leak-kinds=all --track-origins=yes --leak-check=full
perl /path/to/perl/script.pl


and i'm getting the output:
==25483== LEAK SUMMARY:
==25483==    definitely lost: 23,347 bytes in 36 blocks
==25483==    indirectly lost: 76,082 bytes in 33 blocks
==25483==      possibly lost: 14,593,429 bytes in 52,715 blocks
==25483==    still reachable: 111,559 bytes in 2,948 blocks
==25483==         suppressed: 0 bytes in 0 blocks


When i look into the log file i see a lot of entries like:


==25498== 2 bytes in 1 blocks are possibly lost in loss record 1 of
5,588 
==25498==    at 0x4C29E6F: malloc
(in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 
==25498==
by 0x4EE1051: Perl_safesysmalloc
(in /usr/lib/perl5/core_perl/CORE/libperl.so) 
==25498==    by
0x4EE13E6: Perl_savepvn (in /usr/lib/perl5/core_perl/CORE/libperl.so)
==25498==    by 0x4F16B38: Perl_sv_magicext
(in /usr/lib/perl5/core_perl/CORE/libperl.so) 
==25498==    by
0x4F1A38A: Perl_sv_magic (in /usr/lib/perl5/core_perl/CORE/libperl.so)
==25498==    by 0x4E8F85E: Perl_gv_fetchpvn_flags
(in /usr/lib/perl5/core_perl/CORE/libperl.so) 
==25498==    by
0x4E89E2B: perl_parse (in /usr/lib/perl5/core_perl/CORE/libperl.so)
==25498==    by 0x400D9A: main (in /usr/bin/perl)


(i also get entries: "Use of uninitialised value")

I even tried to set the environment variables PERL_DESTRUCT_LEVEL,
PERL_DEBUG, PERL_VALGRIND as described in
http://www.perlmonks.org/?node_id=550371 
Without any success.

Did someone encounter this kind of issue in the past? If yes, how it
was solved? 


My perl version is 5.22.0.


Thank you and best regards,
David Santiago
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWDWszAAoJEJ/OLjwuDYzK3y0H/0bJoCx6o6xdjTb3DUuoLQIp
Gyt/I7URulDEzKY9KAPWiTOECWiC12ZbqYg/dNID/p+Ap3UhOYnHTjIqs7M6Cmaz
RpzFU1nF/o8gpvkC3Rjr7iLsjtZuNIbMJvsH7Wp447qxD73JDtJdHGcS82a2wy3A
aIzy6sfpFesHPHAZNmitRgWReEtwHHBuKdxJyGOgkIGm6pIQFo+h7GMJmbdIsG+R
zBIOUIczMo8lRf9VbbhoYtgIZlhr1PQhG2LYHwOMeD2CXDj9vwNS47WagCv0fSv+
a0ZR4uj8+q9HAoTUkbdaTZfbkMzi0p3Hd0Sgxw0BtjZ48uwtjZ+qkk7h8KKk5I0=
=rI+0
-----END PGP SIGNATURE-----

Reply via email to