develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #57174] Recursion memory leak when assignment in if condition

Thread Next
From:
Thushan Abeysekera
Date:
July 21, 2008 09:40
Subject:
[perl #57174] Recursion memory leak when assignment in if condition
Message ID:
rt-3.6.HEAD-29759-1216649574-167.57174-75-0@perl.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@computershare.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.

Script 1 (This has the memory leak):
===================================


use strict; 
test1();

sub test1 {
    my $v=0;
    if ($v = get_true()) {
        goto &test1;
    }
}

sub get_true {
    return 1;
}



Script 2 (This runs without a problem):
======================================

use strict; 
test1();

sub test1 {
    my $v=0;
    $v = get_true();
    if ($v) {
        goto &test1;
    }
}

sub get_true {
    return 1;
}


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.




[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.8.6:

Configured by ActiveState at Mon Dec 13 09:51:32 2004.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"C:\Perl586\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"C:\Perl586\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    21540 Fix backward-compatibility issues in if.pm
    23565 Wrong MANIFEST.SKIP

---
@INC for perl v5.8.6:
    c:/Perl586/lib
    c:/Perl586/site/lib
    .

---
Environment for perl v5.8.6:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=c:\perl586\bin;C:\Perl582\bin\;C:\Perl\bin;C:\PROGRA~1\ESWM\CLIENT~1\BIN;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\UltraEdit;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;R:\Resource\GPD\Scripts\Canada;R:\Resource\GPD\Scripts\ver1.40;R:\Resource\GPD\Scripts\Ver1.4;R:\Resource\GPD\Scripts\ver1.40;R:\Resource\bin;C:\Perl586\bin\;C:\Program Files\ATI Technologies\ATI Control Panel
    PERL_BADLANG (unset)
    SHELL (unset)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About