develooper Front page | perl.perl5.porters | Postings from June 2022

PERL_MEM_LOG - broken and useless

Thread Next
From:
Paul "LeoNerd" Evans
Date:
June 9, 2022 17:19
Subject:
PERL_MEM_LOG - broken and useless
Message ID:
20220609181857.3ae4be7b@shy.leonerd.org.uk
I've been trying to track down a tricky memory-leak bug, so I thought
I'd have a go at using the PERL_MEM_LOG machinery.

Turns out: it's broken and doesn't work; and even if it were to work it
would be borderline-useless.

 * Broken: Attempting to actually use it causes a snprintf buffer
   overflow:

    $ PERL_MEM_LOG=s bleadperl program-under-test.pl
    ...
    panic: snprintf buffer overflow at /home/leo/perl5/perlbrew/perls/bleadperl/lib/5.37.1/XSLoader.pm line 112.
    Compilation failed in require.
    BEGIN failed--compilation aborted.

 * Useless: Before it failed, it did print lots of SV creation logs;
   almost every one of them giving the caller location as
   Perl_newSV_type at sv_inline.h line 369 (apart from a scattered few
   that show Perl_sv_newmortal()).

   So even if I fix the snprintf bug, I'll still end up with a log that
   doesn't contain useful information.

This all sounds somewhat familiar to me - turns out I ran into this
second part 3 years ago and came up with a solution. I posted a patch
at the time that didn't end up going anywhere:

  https://www.nntp.perl.org/group/perl.perl5.porters/2019/01/msg253378.html

I'll have a go at resurrecting that patch and making it work on current
blead; if I can make it work expect a PR to add it here.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About