RE: memory leaking with closures

2001-09-07 Thread Arthur Bergman
> On Fri, Sep 07, 2001 at 12:27:58AM -0700, Alex Krohn wrote: > > while (1) { > > { > > my $var = 'x' x 50; > > my $sub = sub { my $sub2 = sub { $var; } }; > > } > > # $var and $sub should be gone, but memory is never freed > > sleep 1; # Don't crash things =) > > } > > > > will grow foreve

Re: memory leaking with closures

2001-09-07 Thread Gurusamy Sarathy
On Fri, 07 Sep 2001 18:06:17 +0200, "Arthur Bergman" wrote: >> On Fri, Sep 07, 2001 at 12:27:58AM -0700, Alex Krohn wrote: >> > while (1) { >> > { >> > my $var = 'x' x 50; >> > my $sub = sub { my $sub2 = sub { $var; } }; >> > } >> > # $var and $sub should be gone, but memory is never freed >>

Re: memory leaking with closures

2001-09-07 Thread Barrie Slaymaker
On Fri, Sep 07, 2001 at 12:27:58AM -0700, Alex Krohn wrote: > while (1) { > { > my $var = 'x' x 50; > my $sub = sub { my $sub2 = sub { $var; } }; > } > # $var and $sub should be gone, but memory is never freed > sleep 1; # Don't crash things

Re: memory leaking with closures

2001-09-07 Thread Stas Bekman
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) { > >

Re: memory leaking with closures

2001-09-07 Thread Perrin Harkins
> > 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 50; >my $s

Re: memory leaking with closures

2001-09-07 Thread Stas Bekman
On Fri, 7 Sep 2001, Alex Krohn wrote: > Hi, > > > >> With this simple test script: > > >> > > >> print "Content-type: text/html\n\n"; > > >> my $var = 'x' x 50; > > > > > > our $var = 'x' x 50; > > > > > >> > > >> my $sub = sub { my $sub2 = sub { $var; }; }; > > >> print "Done\n"; > > >>

Re: memory leaking with closures

2001-09-07 Thread Alex Krohn
Hi, > >> With this simple test script: > >> > >> print "Content-type: text/html\n\n"; > >> my $var = 'x' x 50; > > > > our $var = 'x' x 50; > > > >> > >> my $sub = sub { my $sub2 = sub { $var; }; }; > >> print "Done\n"; > >> > >> $var does not get freed, and the process grows each request

Re: memory leaking with closures

2001-09-06 Thread Ken Williams
___cliff rayman___ <[EMAIL PROTECTED]> wrote: > Alex Krohn wrote: > >> Hi, >> >> With this simple test script: >> >> print "Content-type: text/html\n\n"; >> my $var = 'x' x 50; > > our $var = 'x' x 50; > >> >> my $sub = sub { my $sub2 = sub { $var; }; }; >> print "Done\n"; >> >> $var doe

Re: memory leaking with closures

2001-09-06 Thread ___cliff rayman___
Alex Krohn wrote: > Hi, > > With this simple test script: > > print "Content-type: text/html\n\n"; > my $var = 'x' x 50; our $var = 'x' x 50; > > my $sub = sub { my $sub2 = sub { $var; }; }; > print "Done\n"; > > $var does not get freed, and the process grows each request. Has anyone >

Re: memory leaking with closures

2001-09-06 Thread Perrin Harkins
> With this simple test script: > > print "Content-type: text/html\n\n"; > my $var = 'x' x 50; > my $sub = sub { my $sub2 = sub { $var; }; }; > print "Done\n"; > > $var does not get freed, and the process grows each request. Has anyone > seen this sort of behavior and have any ideas/workaround