develooper Front page | perl.perl5.porters | Postings from February 2012

[perl #109762] Memory leak evaluating version objects in boolean context

Thread Previous
From:
David Golden
Date:
February 3, 2012 20:25
Subject:
[perl #109762] Memory leak evaluating version objects in boolean context
Message ID:
rt-3.6.HEAD-14510-1328329530-1014.109762-75-0@perl.org
# New Ticket Created by  David Golden 
# Please include the string:  [perl #109762]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=109762 >



This is a bug report for perl from dagolden@cpan.org,
generated with the help of perlbug 1.39 running under perl 5.14.0.


-----------------------------------------------------------------
[Please describe your issue here]

I've found a memory leak when a version object is evaluated
in boolean context.

Can be replicated with this one-liner:

perl -Mversion -wE \
  'while (1) { my $v = version->new("1.23"); my $b = !!$v }'

Run it and watch your free memory disappear.

Confirmed in blead and 5.14 on linux.  Others on #p5p observed it on
other platforms and perls, including Windows and 5.12.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=high
    module=version
---
Site configuration information for perl 5.14.0:

Configured by david at Mon Jun  6 22:42:49 EDT 2011.

Summary of my perl5 (revision 5 version 14 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=2.6.35-28-generic, archname=x86_64-linux
    uname='linux icarus 2.6.35-28-generic #50-ubuntu smp fri mar 18 18:42:20 utc 2011 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/david/perl5/perlbrew/perls/perl-5.14.0'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.5', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /usr/lib/x86_64-linux-gnu /lib64 /usr/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.12.1.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.12.1'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.14.0:
    /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/x86_64-linux
    /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0
    /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/x86_64-linux
    /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0
    .

---
Environment for perl 5.14.0:
    HOME=/home/david
    LANG=en_US.utf8
    LANGUAGE (unset)
    LC_COLLATE=C
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=~/git/utility-scripts/:/home/david/perl5/perlbrew/bin:/home/david/perl5/perlbrew/perls/perl-5.14.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:.
    PERLBREW_BASHRC_VERSION=0.36
    PERLBREW_HOME=/home/david/.perlbrew
    PERLBREW_PATH=/home/david/perl5/perlbrew/bin:/home/david/perl5/perlbrew/perls/perl-5.14.0/bin
    PERLBREW_PERL=perl-5.14.0
    PERLBREW_ROOT=/home/david/perl5/perlbrew
    PERLBREW_VERSION=0.23
    PERL_BADLANG (unset)
    PERL_EXTUTILS_AUTOINSTALL=--defaultdeps
    SHELL=/bin/bash


Thread Previous


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