This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Perl bug?


Corinna Vinschen schrieb:
On Jan 22 11:26, Yitzchak Scott-Thoennes wrote:
Hi,

consider the following statement:

$a = "a" x (100 * 1024 * 1024)

When you create a script which does this over and over again, you'll
observe a strange memory problem.
Can you show your script?

#!/usr/bin/perl $a = "a" x (100 * 1024 * 1024); sleep 5; $b = "b" x (100 * 1024 * 1024); sleep 5; $c = "c" x (100 * 1024 * 1024); sleep 5;

....


perl is made this way. All vars are still in scope and all vars together require a lot of memory.

How about:
#!/usr/bin/perl
{
  my $a = "a" x (100 * 1024 * 1024);
  sleep 5;
}
{
  my $b = "b" x (100 * 1024 * 1024);
  sleep 5;
}
{
  my $c = "c" x (100 * 1024 * 1024);
  sleep 5;
}
...

Than you get better mmap figures.


-- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://helsinki.at/ http://spacemovie.mur.at/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]