Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • #p5p

    [16:49] <shadowpaste> "daxim" at 217.168.150.38 pasted "recursion does not release memory for reuse?" (14 lines) at http://paste.scsys.co.uk/45082
    [16:49] <dipsy> [ magnet_web paste from "daxim" at 217.168.150.38... ]
    [16:49] <daxim> what's going on here?
    [16:50] <Zefram> fragmentation?
    [16:50] <purl> fragmentation is interesting
    [16:50] <Nicholas> no, Pad frames created for recursion are not released
    [16:50] <Nicholas> the assumption is that you'll recurse again
    [16:51] <Nicholas> patches not unwelcome to add the option to change this
    [16:51] <Nicholas> but I've not thought totally about how to do it
    [16:51] <Nicholas> you could, in theory, do it from XS
    [16:51] <Nicholas> manually, on subrouties by passing in a reference to them
    [16:52] <Zefram> keeping pads beyond N levels deep seems like a bad idea
    [16:53] <Nicholas> actually, better I think is is "keeping pads N levels deeper than the level you just left"
    [16:53] <Zefram> if you're recursing deep, you're spending enough time that the overhead of reallocating pads is probably not a worry
    [16:53] <Zefram> yes, was just about to suggest that.  hysteresis
    [16:53] <Nicholas> that would avoid penalising things that recurse and stay recursed
    [16:53] <Zefram> yes

    • perl -MTest::LeakTrace -le 'sub r {return if !$_[0]; r($_[0]-1); } r(1); leaktrace{ r(1);};'

      Hmm yes the second recursion calling is not leaking memory any more.