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

[ID 20000928.003] A memory leak of 0.025 bytes per subroutineprototype

From:
ilya
Date:
September 28, 2000 12:28
Subject:
[ID 20000928.003] A memory leak of 0.025 bytes per subroutineprototype
Message ID:
200009281927.e8SJRxG28072@monk.mps.ohio-state.edu
This is a bug report for perl from ilya@monk.mps.ohio-state.edu,
generated with the help of perlbug 1.32 running under perl v5.7.0.


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

No, do not ask me how it may be have 0.025 bytes per iteration, but
the following code leaks:

  eval q( sub ($$) {} )

I suspected a  similar bug  (but with  4 bytes  per  iteration) while
reading the code for 5.005_64 (SvPOK_off in cv_undef()).  It looks
like it is in 5.7.0 too (two invocations differ by the argument 100000
vs 200000 only):

 env PERL_DEBUG_MSTATS=1 ./perl -wle '$i = shift; \
			 $s = eval q( sub ($$) {} ) while --$i' 100000
 Name "main::s" used only once: possible typo at -e line 1.
 Memory allocation statistics after execution:   (buckets 4(4)..8184(8192)
    19016 free:   191    41    12     7    10   8   3     2   1 0 0
	       465    97    64    24    19
    57908 used:    64    86    51    55     6   8   9    22   0 1 1
		46    73   191    60     6
 Total sbrk(): 78872/14:162. Odd ends: pad+heads+chain+tail: 1048+900+0+0.
==================================================================
 env PERL_DEBUG_MSTATS=1 ./perl -wle '$i = shift; \
			  $s = eval q( sub ($$) {} ) while --$i' 200000
 Memory allocation statistics after execution:   (buckets 4(4)..8184(8192)
    20384 free:   191    35    62    32    10   8   3     1   1 0 0
	       465    97    52    15    19
    60540 used:    64    92    64    61     6   8   9    23   0 1 1
		46    73   203    69     6
 Total sbrk(): 82968/15:163. Odd ends: pad+heads+chain+tail: 1048+996+0+0.

Ilya

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

Configured by ilya at Tue Sep 26 23:09:09 EDT 2000.

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.8, archname=sun4-solaris
    uname='sunos monk 5.8 generic sun4u sparc '
    config_args='-des -D usedevel'
    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 ='-I/usr/local/include -I/opt/local/include -I/opt/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O', cppflags='-I/usr/local/include -I/opt/local/include -I/opt/gnu/include'
    ccversion='WorkShop Compilers 5.0 98/12/15 C 5.0', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/local/lib -L/opt/gnu/lib -L/opt/SUNWspro/SC5.0/lib '
    libpth=/usr/local/lib /opt/local/lib /opt/gnu/lib /opt/SUNWspro/SC5.0/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/opt/local/lib -L/opt/gnu/lib -L/opt/SUNWspro/SC5.0/lib'

Locally applied patches:
    

---
@INC for perl v5.7.0:
    lib
    /home/ilya/perl
    /home/ilya/perl/lib/perl5/site_perl/5.005
    /home/ilya/perl/lib/perl5
    /home/ilya/perl/lib/perl5/site_perl
    /home/ilya/perl/lib/perl5/site_perl/sun4-solaris
    /home/ilya/perl/lib/perl5/site_perl/5.005/sun4-solaris
    /home/ilya/perl/lib/perl5/5.00503/
    /usr/local/lib/perl5/5.7.0/sun4-solaris
    /usr/local/lib/perl5/5.7.0
    /usr/local/lib/perl5/site_perl/5.7.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.7.0
    /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.7.0:
    HOME=/home/ilya
    LANG=en_US.ISO8859-1
    LANGUAGE (unset)
    LC_COLLATE=en_US.ISO8859-1
    LC_CTYPE=en_US.ISO8859-1
    LC_MESSAGES=C
    LC_MONETARY=en_US.ISO8859-1
    LC_NUMERIC=en_US.ISO8859-1
    LC_TIME=en_US.ISO8859-1
    LD_LIBRARY_PATH=/opt/local/lib:/usr/openwin/lib:/opt/local/lib/rvplayer5.0:/opt/X11/lib:/opt/local/lib:/usr/openwin/lib:/opt/local/lib/rvplayer5.0:/opt/X11/lib:/opt/local/lib:/usr/openwin/lib:/opt/local/lib/rvplayer5.0:/opt/X11/lib
    LOGDIR (unset)
    PATH=/home/ilya/bin:/opt/SUNWspro/bin:/usr/dt/bin:/usr/ccs/bin:/usr/java/bin:/opt/netscape:/opt/microsoft/bin:/opt/Office52/program:/opt/gnu/bin:/usr/openwin/bin:/opt/X11/bin:/home/tex/bin:/opt/local/bin:/usr/bin:/opt/local/games:/opt/unsup/ilya/bin:.
    PERLLIB=/home/ilya/perl:/home/ilya/perl/lib/perl5/site_perl/5.005:/home/ilya/perl/lib/perl5:/home/ilya/perl/lib/perl5/site_perl:/home/ilya/perl/lib/perl5/site_perl/sun4-solaris:/home/ilya/perl/lib/perl5/site_perl/5.005/sun4-solaris:/home/ilya/perl/lib/perl5/5.00503/
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh




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