develooper Front page | perl.perl5.porters | Postings from December 2001

[BUG] Localized tied array and hash elements leaking memory

From:
Michael G Schwern
Date:
December 30, 2001 15:18
Subject:
[BUG] Localized tied array and hash elements leaking memory
Message ID:
20011230231803.GH12840@blackrider
Something wrong with my copy of perlbug.


To: perlbug@perl.org
Subject: Tied localized hash and array elements leak memory
Cc: schwern@pobox.com
Reply-To: schwern@pobox.com

This is a bug report for perl from schwern@pobox.com,
generated with the help of perlbug 1.33 running under perl v5.6.1.


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

localizing a tied array or hash element appears to leak memory.  The
following program grows to almost 12 megs on my system.  This was
noticed when doing a "local $sth->{TAINT}" in a DBI program.

Localizing untied hash and array elements don't have this problem, nor
do localized tied scalars.

It effects bleadperl back to at least 5.005_03 and possibly further.


use Tie::Hash;
use Tie::Array;
use Tie::Scalar;

tie %hash, 'Tie::StdHash', (foo => 42);
tie @array, 'Tie::StdArray', (1, 2);
tie $foo,  'Tie::StdScalar', 23;

for(1..100000) {
    local $hash{foo} = 'bar';
#    local $array[2] = 'bar';
#    local $foo = 42;
}
print "Done\n";
sleep 999;


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

Configured by bod at Tue Dec  4 01:38:52 EST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.13-pre3-ben0, archname=powerpc-linux
    uname='linux vir 2.4.13-pre3-ben0 #1 thu oct 18 23:51:21 est 2001 ppc unknown '
    config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=powerpc-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Dotherlibdirs=/usr/lib/perl5/5.6:/usr/lib/perl5/5.005 -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.4 20011006 (Debian prerelease)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt
    perllibs=-ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.4.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.1:
    /usr/local/lib/perl/5.6.1
    /usr/local/share/perl/5.6.1
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.6.1
    /usr/share/perl/5.6.1
    /usr/local/lib/site_perl/powerpc-linux
    /usr/local/lib/site_perl
    /usr/local/share/perl/5.6.0
    /usr/lib/perl5/5.6/powerpc-linux
    /usr/lib/perl5/5.6
    /usr/lib/perl5/5.005/powerpc-linux
    /usr/lib/perl5/5.005
    .

---
Environment for perl v5.6.1:
    HOME=/home/schwern
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/schwern/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/X11/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash



-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl Quality Assurance	    <perl-qa@perl.org>	       Kwalitee Is Job One
Obscenity is the last resort of the illiterate, Mother Fucker
	-- KAL



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