From: "M. Edward (Ed) Borasky" Date: 2007-08-07T12:31:54+09:00 Subject: Re: [ANN] Free RAM 1.0 Alex Gutteridge wrote: > On 7 Aug 2007, at 07:06, Ari Brown wrote: > >> Hey! >> >> Despite your best efforts, Todd, I managed to create a tool which will >> free RAM to be used by other programs. >> >> At the moment, it is only usable on *nix machines (BSD, Linux, and >> Mac). Will add Windows support soon. >> move it to /bin and save it as free_ram >> >> Usage: free_ram TIME >> TIME is the amount of time you want Ruby to spend clearing the RAM. A >> good amount is about 20. I can clear a large amount of RAM with that. >> >> http://www.aribrown.com/ruby/free_ram.rb > > Other people have explained why this really isn't such a great idea, but > in the spirit of experimentation... > > If you want a portable version why not just: > > require 'timeout' > > z = '' > timeout(25){ while(true) do z << 0.chr * (2 ** 24) end} > > Or for the 'moar power!!11!' user how about a RubyInline version: > > require 'inline' > > class IWantA > inline do |builder| > builder.c " > int way_to_die(int size){ > return malloc(size); > }" > end > end > > while(IWantA.new.way_to_die(2 ** 12) != 0) > end > > Both managed to shunt almost every other process into swap in a few > seconds. Enjoy! > > Alex Gutteridge > > Bioinformatics Center > Kyoto University > > > > But wait!! I'll C your Ruby Inline and raise you one stress test, i.e., http://weather.ou.edu/~apw/projects/stress I can take a machine down instantaneously with their memory hog. ;)