[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [ot] Re: My Swap partition never get used



On Tue, Jul 02, 2002 at 03:45:34AM -0400, ThanhVu Nguyen wrote:

| > Did you try firing up emacs? ;-)
| 
| Probably not opening enough apps to really show if it's really the
| swap problem.  But I can't be sure either that swap partition is good
| or not.  
| 
| Is there a way to fill up all the Ram so I can check what happens ?

That's the easy part.  The hard part is writing a complex program with
no memory leaks.  Here's a nice program that is nothing but a memory
sink :

#!/usr/bin/env python

i = 0L
l = []
while 1 :
    l.append( i )
    i += 1



If you prefer a C implementation :

int main()
{
    while ( 1 )
    {
        if ( ! malloc(1024) ) break ;
    }
    return 0 ;
}


When you test these, make sure you have some sort of memory monitor
running, and keep the program in the foreground of your shell so that
you can kill it (^C) when you have seen what you want to see.  If you
don't, the program will keep going sucking up all the memory in your
system and the kernel will start arbitrarily killing processes trying
to save the system.  Eventually it will get killed, but a lot of other
stuff is likely to get killed too.  I think the C version is actually
a little bit nicer since it will terminate if the memory allocation
fails.  However, before the malloc fails, your system won't be a
pretty sight.

HTH,
-D

-- 

If Microsoft would build a car...
... Occasionally your car would die on the freeway for no reason. You
would have to pull over to the side of the road, close all of the car
windows, shut it off, restart it, and reopen the windows before you
could continue. For some reason you would simply accept this.
 
http://dman.ddts.net/~dman/

Attachment: pgpGlDfhBee2V.pgp
Description: PGP signature


Reply to: