Front page | perl.perl5.porters |
Postings from January 2001
[ID 20010131.013] Possible Memory Leak In Tied Array List Assignment
From:
sam
Date:
January 31, 2001 10:11
Subject:
[ID 20010131.013] Possible Memory Leak In Tied Array List Assignment
Message ID:
200101311755.MAA23560@royal.tregar.com
This is a bug report for perl from sam@royal.tregar.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.
-----------------------------------------------------------------
[Please enter your report here]
During development of a tied array module I discovered a strange
memory leak. The test script below should reproduce the problem.
This is as small as I could make it and still see the problem.
#!/usr/bin/perl -w
package Foo;
use base 'Tie::Array';
sub TIEARRAY { bless([], $_[0]); }
sub STORE { $_[0]->[$_[1]] = $_[2]; }
sub STORESIZE { $#{$_[0]} = $_[1]; }
package main;
print "Creating array of 0 .. 100_000 in for loop...\n";
my @b;
tie @b, 'Foo';
for (0 .. 100_000) {
$b[$_] = $_;
}
print "Go check out top and then hit return...\n";
$_ = <STDIN>;
print "Creating array of 0 .. 100_000 with list assignment...\n";
my @a;
tie @a, 'Foo';
@a = (0 .. 100_000);
print "Go check out top and then hit return...\n";
$_ = <STDIN>;
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.6.0:
Configured by sam at Sat Jul 15 18:22:02 EDT 2000.
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.14, archname=i586-linux
uname='linux royal 2.2.14 #2 thu jan 20 01:03:58 est 2000 i586 unknown '
config_args='-de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
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, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
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.0:
/usr/local/lib/perl5/5.6.0/i586-linux
/usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/i586-linux
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl
.
---
Environment for perl v5.6.0:
HOME=/home/sam
LANG=en_US
LANGUAGE (unset)
LC_ALL=en_US
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/sam/bin:/usr/local/jdk/bin/i686/native_threads/
PERL_BADLANG (unset)
SHELL=/bin/bash2
-
[ID 20010131.013] Possible Memory Leak In Tied Array List Assignment
by sam