Not logged in
Log in now
Create an account
Subscribe to LWN
Recent Features
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
(Nearly) full tickless operation in 3.10
Errr, care to share it with us?
User-space software suspend
Posted Nov 4, 2005 0:43 UTC (Fri) by zblaxell (subscriber, #26385) [Link]
sub swapfree { open(PROC, "/proc/meminfo") or die "open: /proc/meminfo: $!"; my ($swapfree) = grep(/^SwapFree:/, <PROC>); close(PROC); $swapfree =~ s/\D+//gos; print STDERR "swapfree=$swapfree\n"; return $swapfree; }
my $last_swapfree = swapfree; my @blobs;
my $count = 0; my $total = 0;
my $start_time = time;
while ($last_swapfree <= (my $new_swapfree = swapfree)) { ++$count; push(@blobs, ('.' x (1048576 * $count))); $total += $count; print STDERR "${total}M allocated\n"; $last_swapfree = $new_swapfree; } system("ps m $$"); print STDERR time - $start_time, " seconds\n";
Copyright © 2013, Eklektix, Inc. Comments and public postings are copyrighted by their creators. Linux is a registered trademark of Linus Torvalds