Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

memory leak in perl 5.005_3 #1178

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2148 (status was 'resolved')

Searchable as RT2148$

p5pRT commented 24 years ago

From ank@ElCat.KG

Created by ank@elcat.kg

#!/usr/bin/perl

# # example of memory leak in perl5.005_3\, tested on FreeBSD 2.x 3.x # use /usr/bin/top or /bin/ps for memory usage.

# /usr/bin/perl -v # # This is perl\, version 5.005_03 built for i386-freebsd # # Copyright 1987-1999\, Larry Wall # # Perl may be copied only under the terms of either the Artistic License or the # GNU General Public License\, which may be found in the Perl 5.0 source kit. # # Complete documentation for Perl\, including FAQ lists\, should be found on # this system using `man perl' or `perldoc perl'. If you have access to the # Internet\, point your browser at http​://www.perl.com/\, the Perl Home Page.

@​c = ("Async32"x4\, "Async32"x5\, "Async32"x7\, "Async32"x10);

while (1) {   foreach (@​c)   {   $_ =~ s/Async/ Async/;   } }

Perl Info ``` Site configuration information for perl 5.00503: Configured by markm at $Date: 1999/05/05 19:42:40 $. Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=freebsd, osvers=4.0-current, archname=i386-freebsd uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current #0: $Date: 1999/05/05 19:42:40 $' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release) cppflags='' ccflags ='' stdchar='char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E' libpth=/usr/lib libs=-lm -lc -lcrypt libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3 Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fpic', lddlflags='-shared' Locally applied patches: @INC for perl 5.00503: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . Environment for perl 5.00503: HOME=/home/ank LANG=ru_RU.KOI8-R LANGUAGE (unset) LC_ALL=ru_RU.KOI8-R LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/ank/bin:/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin: PERL_BADLANG (unset) SHELL=/usr/local/bin/bash ```
p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

On Tue\, Feb 15\, 2000 at 01​:20​:28PM +0500\, Andrey Kolotev wrote​:

@​c = ("Async32"x4\, "Async32"x5\, "Async32"x7\, "Async32"x10);

while (1) { foreach (@​c) { $_ =~ s/Async/ Async/; } }

You're forever adding spaces and complain of a memory leak?

-- The idea is that the first face shown to people is one they can readily accept - a more traditional logo. The lunacy element is only revealed subsequently\, via the LunaDude. [excerpted from the Lunatech Identity Manual]

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

On Tue\, Feb 15\, 2000 at 10​:59​:58AM +0100\, Bart Schuller wrote​:

On Tue\, Feb 15\, 2000 at 01​:20​:28PM +0500\, Andrey Kolotev wrote​:

@​c = ("Async32"x4\, "Async32"x5\, "Async32"x7\, "Async32"x10);

while (1) { foreach (@​c) { $_ =~ s/Async/ Async/; } }

You're forever adding spaces and complain of a memory leak?

But I don't save any info about this. I don't modify array @​c. It's constantly consist of 4 fixed strings\, I modify only temporary var $_;

Thank you.

-- The idea is that the first face shown to people is one they can readily accept - a more traditional logo. The lunacy element is only revealed subsequently\, via the LunaDude. [excerpted from the Lunatech Identity Manual]

-- Andrey Kolotev

p5pRT commented 24 years ago

From @jandubois

On Tue\, 15 Feb 2000 15​:05​:48 +0500\, Andrey Kolotev \ank@​ElCat\.KG wrote​:

On Tue\, Feb 15\, 2000 at 10​:59​:58AM +0100\, Bart Schuller wrote​:

On Tue\, Feb 15\, 2000 at 01​:20​:28PM +0500\, Andrey Kolotev wrote​:

@​c = ("Async32"x4\, "Async32"x5\, "Async32"x7\, "Async32"x10);

while (1) { foreach (@​c) { $_ =~ s/Async/ Async/; } }

You're forever adding spaces and complain of a memory leak?

But I don't save any info about this. I don't modify array @​c. It's constantly consist of 4 fixed strings\, I modify only temporary var $_;

Yes\, you do save the new strings\, because you do modify @​c. Please read the perlsyn manpage again\, especially the section about the foreach loop. The loop control variable *aliases* to each element of the list.

-Jan

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Andrey Kolotev \ank@​ElCat\.KG wrote

But I don't save any info about this. I don't modify array @​c. It's constantly consist of 4 fixed strings\, I modify only temporary var $_;

You *do* modify @​c. See what perlsyn has to say about foreach and aliasing.

Mike Guy