[ABE.pm] Perl and memory usage

fiedlert at gmail.com fiedlert at gmail.com
Tue Nov 17 07:37:20 PST 2009


What I need to do is fill memory, a little at a time. Im trying to force  
OOM errors. Whith the following Perl exits w/ Out of memory, but no OOM  
kills. Any ideas?

This is what Im using. I also have ulimit set to unlimited. It looks like  
Perl is doing the right thing, by just die-ing. Is there anyway to force it  
do the wrong thing?

#!/usr/bin/perl

use strict;
use warnings;
use Devel::Size qw(size);

my @mem;

while (1)
{
{
open my $contents, "test.256MB" or
die "Unable to open test.256MB: $!\n";
while ( <$contents> )
{
push @mem, $_;
}
}
my $size = size(\@mem);
print "Size = $size \n";
}

On Nov 17, 2009 9:27am, Ricardo Signes <perl.abe at rjbs.manxome.org> wrote:
> * fiedlert at gmail.com [2009-11-17T09:14:39]

> > Anyone know if there is a way to retrieve the amount of memory a  
> variable

> > is using from within Perl?



> Devel::Size is pretty good.



> --

> rjbs

> _______________________________________________

> ABE-pm mailing list

> ABE-pm at pm.org

> http://mail.pm.org/mailman/listinfo/abe-pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/abe-pm/attachments/20091117/f3969390/attachment.html>


More information about the ABE-pm mailing list