On Fri, 7 Sep 2001, Perrin Harkins wrote:
> > > Oddly, if you just do
> > >
> > > my $sub = sub { $var; };
> > >
> > > it does not grow, definately something strange going on. Happens on
> > > perl 5.004_04, 5.005_03 and 5.6.1.
> >
> > You mean this works for you?:
> >
> > while (1) {
> > {
> > my $var = 'x' x 500000;
> > my $sub = sub { $var; };
> > }
> > # $var and $sub should be gone, but memory is never freed
> > sleep 1; # Don't crash things =)
> > }
> >
> > that's because your $sub goes out of scope.
>
> The leaking behavior only happens when you use nested anonymous subs. It
> should always be possible to avoid it, although your code may look uglier.
It only happens if you use double-nested subs, as far as I've tested with
Devel::Peek. Is it documented somewhere in the perl docs?
> > the other one seems like a
> > bug.
> >
> > If I didn't miss something, it seems that we need to run this through p5p.
>
> It's been known about for a while. I'm not sure what the status of getting
> a fix is. I assume that it must be difficult to fix or it would have been
> changed a long time ago.
Do you say that it would be a waste to raise this issue on p5p?
It's very hard to keep up with the traffic on that list along with
[EMAIL PROTECTED], so I'm not aware of many issues discussed there.
unfortunately :(
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/