in reply to How to generate 'fake' memory load?

See also: one-liner hogs. There are at least two flavors of "memory load". Allocating a large string mostly just ends up consuming swap space. Continually updating the contents of a large string can consume physical memory (if the process doesn't just lose out in the fight to keep access to that limited resource).

- tye        

  • Comment on Re: How to generate 'fake' memory load? (hogs)

Replies are listed 'Best First'.
Re^2: How to generate 'fake' memory load? (hogs)
by tilly (Archbishop) on Aug 04, 2008 at 21:09 UTC
    Reading can do the same thing as updating. For instance try the following to allocate about 10 MB of memory and actually keep it active:
    perl -e '$_ = "x" x 10_000_000; $_ .= "y"; sleep 1 while /y/;'
    Update: kyle caught a typo where I switched variable names. Fixed.