#!/usr/bin/perl -s ## ## allocmem -- allocate arbit amountis of RAM. ## ## Syntax : ## -step=mb (Allocate in multiples of 'step' mb) ## -chunks=number (Number of step size chunks to allocate) ## -sleep=seconds (Malloc Interval) $KB = 1024; $MB = 1024 * $KB; $step = 1 unless defined $step; $chunks = 10 unless defined $chunks; $sleep = 1 unless defined $sleep; print "Will allocate $chunks chunks of $step Mb each, with a delay of $sleep \ seconds between two consecutive mallocs...\n\n"; grep { push @dataseg, "\0" x ($step * $MB); print "$_.\tAllocated @{[$_ * $step]} Mbs.\n"; sleep $sleep; } (1..$chunks); print "Deallocating....\n\n";