ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
Re: [perl #57174] Recursion memory leak when assignment in if condition
by Bram other posts by this author
Aug 5 2008 1:33PM messages near this date
[perl #57174] Recursion memory leak when assignment in if condition | [perl #56954] This seems to be fixed in Perl 5.10
Citeren Thushan Abeysekera <perlbug-followup@[...].org> :

>  # New Ticket Created by  "Thushan Abeysekera"
>  # Please include the string:  [perl #57174]
>  # in the subject line of all future correspondence about this issue.
>  # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57174 >
> 
> 
>  This is a bug report for perl from thushan.abeysekera@[...].com,
>  generated with the help of perlbug 1.35 running under perl v5.8.6.
> 
> 
>  -----------------------------------------------------------------
>  There seems to be a memory leak when doing recursion with goto   
>  &sub_name syntax.
>  Run following two endless loops and check memory usage. While script  
>   1 runs out of memory, script 2 runs without a problem.
> 
[snip]
>  Originally observed in: perl, v5.8.6 built for MSWin32-x86-multi-thread
> 
>  This problem can be replicated in perl 5.10.0 i686-linux-thread-multi.
> 
>  Please check http://www.perlmonks.org/?node_id=698735 for a   
>  discussion on this.
> 

$ cat rt-57174.pl
#!/usr/bin/perl -l

use strict;
# use warnings;

my $mem1 = qx/ps u $$/;
my ($vsz1) = $mem1 =~ m/^perl\s+\d+\s+[0-9.]+\s+[0-9.]+\s+(\d+)/m;

my $m = 0;
test1();

my $mem2 = qx/ps u $$/;
my ($vsz2) = $mem2 =~ m/^perl\s+\d+\s+[0-9.]+\s+[0-9.]+\s+(\d+)/m;

if ($vsz1 + 1000 < $vsz2) {
   print "not ok ($vsz1 & $vsz2)";
}
else {
   print "ok";
}

sub test1 {
     my $v=0;
     if ($v = get_true()) {
         if ($m++ < 300_000) {
           goto &test1;
         }
     }
}

sub get_true {
     return 1;
}

__END__

(running with user 'perl')

perl-5.00504 rt-57174.pl
not ok (2708 & 14568)

perl-5.10.0 rt-57174.pl
not ok (3172 & 9144)

perl-blead@34156 rt-57174.pl
not ok (3196 & 9172)

(No access to a system with a perl before 5.00504 atm)

Kind regards,

Bram
Thread:
Thushan Abeysekera
Bram

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved