Closed p5pRT closed 20 years ago
#!/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/; } }
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]
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
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
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
Migrated from rt.perl.org#2148 (status was 'resolved')
Searchable as RT2148$