develooper Front page | perl.perl5.porters | Postings from July 2014

[perl #122283] Possible regexp memory explosion in 5.20.0

Thread Next
From:
Dana Jacobsen via RT
Date:
July 23, 2014 08:17
Subject:
[perl #122283] Possible regexp memory explosion in 5.20.0
Message ID:
rt-4.0.18-25132-1406053779-990.122283-15-0@perl.org
A tool I found useful for this is massif from the valgrind suite, e.g.:

valgrind --tool=massif --stacks=yes --alloc-fn=Perl_safesysmalloc --alloc-fn=Perl_safesyscalloc --alloc-fn=Perl_safesysrealloc --alloc-fn=Perl_Slab_Alloc --time-unit=B --max-snapshots=1000 perl -MMath::Prime::XS=:all -E 'say 1'

(in this case, load up a module and do basically nothing else), then:

massif-visualizer massif.out.####  [#### depending on the file]

to see the graphical results.

This shows, for example, a memory spike from Perl__invlist_union_maybe_complement_2nd that shows up in 5.20.0 and 5.21.2 that is not in 5.19.7 when processing constant.pm's:

  my $normal_constant_name = qr/^_?[^\W_0-9]\w*\z/;

which means it hits lots of modules.  Tracking down the Perl source that causes given memory behavior is not very straightforward, but I think the tool is pretty valuable for seeing how memory is being used, and what is causing the use, over time.

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122283

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