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

[perl #122283] Possible regexp memory explosion in 5.20.0

Thread Next
Dana Jacobsen via RT
July 23, 2014 08:17
[perl #122283] Possible regexp memory explosion in 5.20.0
Message ID:
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'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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About