Perl bug?

Reini Urban rurban@x-ray.at
Mon Jan 22 22:56:00 GMT 2007


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/



More information about the Cygwin mailing list