develooper Front page | perl.perl5.porters | Postings from September 2006

[perl #40389] perl_destruct() leaks PL_defstash

Thread Next
From:
gozer @ activestate . com
Date:
September 22, 2006 02:21
Subject:
[perl #40389] perl_destruct() leaks PL_defstash
Message ID:
rt-3.5.HEAD-31263-1158871745-1942.40389-75-0@perl.org
# New Ticket Created by  gozer@activestate.com 
# Please include the string:  [perl #40389]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40389 >



This is a bug report for perl from gozer@activestate.com,
generated with the help of perlbug 1.35 running under perl 5.9.4.


-----------------------------------------------------------------
[Please enter your report here]

In perl_destruct():

1061:    /* Prepare to destruct main symbol table.  */
1062:
1063:    hv = PL_defstash;
1064:    PL_defstash = 0;
1065:    SvREFCNT_dec(hv); /* At this point, SvREFCNT(hv) is 2 */
1066:    SvREFCNT_dec(PL_curstname);

It would seem it's caused by a self-reference somewhere, since adding
hv_clear(hv) before the call to SvREFCNT_dec() brings the refcnt down
to 1.

$> perl -e1
perl_destruct leaking a PL_defstash with refcnt=2

is enough to demonstrate this bug

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

Configured by gozer at Thu Sep 21 13:27:41 PDT 2006.

Summary of my perl5 (revision 5 version 9 subversion 4 patch 28880) configuration:
  Platform:
    osname=linux, osvers=2.6.17-1.2174_fc5smp, archname=i686-linux-thread-multi
    uname='linux coupler.activestate.com 2.6.17-1.2174_fc5smp #1 smp tue aug 8 16:00:39 edt 2006 i686 i686 i386 gnulinux '
    config_args='-des -Dusedevel -Duseshrplib -Dusethreads -Duseithreads -Doptimize=-g -Dprefix=/home/gozer/opt/perl/i386-linux/current/debug/28880'
    hint=recommended, useposix=true, d_sigaction=define
    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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='4.1.1 20060525 (Red Hat 4.1.1-1)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.4.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/gozer/opt/perl/i386-linux/current/debug/28880/lib/5.9.4/i686-linux-thread-multi/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.9.4:
    /home/gozer/opt/lib/perl5
    /home/gozer/opt/lib/perl5/site_perl
    /home/gozer/opt/perl_lib/lib
    /home/gozer/opt/perl/i386-linux/current/debug/28880/lib/5.9.4/i686-linux-thread-multi
    /home/gozer/opt/perl/i386-linux/current/debug/28880/lib/5.9.4
    /home/gozer/opt/perl/i386-linux/current/debug/28880/lib/site_perl/5.9.4/i686-linux-thread-multi
    /home/gozer/opt/perl/i386-linux/current/debug/28880/lib/site_perl/5.9.4
    .

---
Environment for perl 5.9.4:
    HOME=/home/gozer
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/gozer/opt/lib
    LOGDIR (unset)
    PATH=/home/gozer/bin:/home/gozer/opt/bin:/home/gozer/bin:/home/gozer/opt/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/lib/jre/bin:/home/gozer/bin:/home/gozer/opt/activestate.com/komodo/current/bin:/usr/lib/jre/bin:/home/gozer/bin:/home/gozer/opt/activestate.com/komodo/current/bin
    PERL5LIB=/home/gozer/opt/lib/perl5:/home/gozer/opt/lib/perl5/site_perl:/home/gozer/opt/perl_lib/lib
    PERL5_CPANPLUS_CONFIG=/home/gozer/.cpanplus/config
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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