On Thu Feb 12 08:06:08 2015, tiro wrote: > Tony, > > Thank you for looking at this and for the quick reply. > > The test script I previously provided had perl hardcoded so probably > wasn't > much use; sorry about that. Also, I should have mentioned that simple > constants like '1' didn't trigger the leak for me. > > I didn't have a copy of perl with threads support, so built perl > v5.20.1 from > the git source. I found that valgrind still shows definite memory loss > when > using utf8, even with threads. Am I missing something? No, it's a real bug, still present in maint-5.20. The leak isn't from loading utf8.pm itself, but from doing variable name lookups in its context, so with one variable, one block is leaked: tony@mars:.../git/perl$ valgrind -q --leak-check=full ./perl -Ilib -Mthreads -Mutf8 -e '$x' ==14713== 3 bytes in 1 blocks are definitely lost in loss record 1 of 7 ==14713== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14713== by 0x4919E1: Perl_safesysmalloc (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x522545: Perl_bytes_from_utf8 (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x46B4E5: Perl_pad_findmy_pvn (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x4562C6: Perl_yylex (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x46645F: Perl_yyparse (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x43F6A4: perl_parse (in /home/tony/dev/perl/git/perl/perl) ==14713== by 0x41EDF8: main (in /home/tony/dev/perl/git/perl/perl) ==14713== with 3 variables, 3 blocks are leaked: tony@mars:.../git/perl$ valgrind -q --leak-check=full ./perl -Ilib -Mthreads -Mutf8 -e '$x,$y,$z' ==14737== 9 bytes in 3 blocks are definitely lost in loss record 1 of 7 ==14737== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==14737== by 0x4919E1: Perl_safesysmalloc (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x522545: Perl_bytes_from_utf8 (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x46B4E5: Perl_pad_findmy_pvn (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x4562C6: Perl_yylex (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x46645F: Perl_yyparse (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x43F6A4: perl_parse (in /home/tony/dev/perl/git/perl/perl) ==14737== by 0x41EDF8: main (in /home/tony/dev/perl/git/perl/perl) ==14737== This isn't an issue in blead, since the leaking code is no longer present - all pad names are in utf-8 so there's no need to convert. The attached patch appears to fix the problem for maint-5.20. Tony --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=123786Thread Previous | Thread Next