New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
should goto &NAME free lexicals? #7118
Comments
From sorourke@cs.ucsd.eduThis is a bug report for perl from seano@cs.ucsd.edu, From the description in perlfunc, I thought you could use "goto-&FUNC" perl -e 'sub foo { my $x = shift; print $x unless $x%100000; foo($x-1) } foo(1);' perl -e 'sub foo { my $x = shift; print $x unless $x%100000; @_=($x-1);goto &foo }' perl -e 'sub foo { print $_[0] unless $_[0]%100000; $_[0]--;goto &foo } foo($x=1)' With 5.8.3 on OS X, the first (of course) quickly grows out of Flags: Site configuration information for perl v5.8.3: Configured by seanorourke at Sun Jan 25 10:48:24 PST 2004. Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration: Locally applied patches: @INC for perl v5.8.3: Environment for perl v5.8.3: |
From whatever@davidnicol.comthe C<goto &NAME> construct is not for tail recursion, but I hope someone will correct me if I'm wrong, but I don't think #!/usr/bin/perl sub foo_worker{ # in a real system there would be several of these sub call_my_foo{ # the dispatch routine $nextval = 1; for(;;){ __END__ That will run forever and not grow. On Fri, 2004-02-20 at 12:37, Sean O'Rourke wrote:
|
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Tue, Feb 24, 2004 at 12:00:22AM -0600, david nicol wrote:
Well, C<goto &foo> is deliberatley designed to pop the current call off -- |
From whatever@davidnicol.comOn Tue, 2004-02-24 at 03:23, Dave Mitchell wrote:
Then it isn't just lexicals that aren't getting cleaned up: perl -le '$x = 1; sub f(){ ++$x % 10000 or print $x; goto &f}; f' leaks too. -- |
From @iabynOn Fri, Feb 20, 2004 at 06:37:39PM -0000, Sean O'Rourke wrote:
The leak is tiggered by the assignment to @_. This causes a copy of Fixed by the following change. Dave. -- Change 22373 by davem@davem-percy on 2004/02/24 23:25:52 [perl #26959] fix memory leak in @_ = ...; goto &sub Affected files ... ... //depot/perl/pp_ctl.c#384 edit Differences ... ==== //depot/perl/pp_ctl.c#384 (text) ==== @@ -2182,6 +2182,7 @@ label = 0; /* Now do some callish stuff. */ |
From @iabynOn Tue, Feb 24, 2004 at 04:14:47AM -0600, david nicol wrote:
only prior to 5.8.1 -- |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#26959 (status was 'resolved')
Searchable as RT26959$
The text was updated successfully, but these errors were encountered: