Subject: Re: User process eating memory makes system unusable & sometimes crashes it.
To: theo borm <email@example.com>
From: Ben Collver <firstname.lastname@example.org>
Date: 11/30/2004 08:17:13
This problem interested me, so I took a look at your code. I ran the
code under NetBSD 1.6.2 i386 and was unable to reproduce your problem.
However, here is what I did observe:
When I ran out of swap, the last realloc() failed and I was punted back
to the shell prompt. I am not sure why realloc() returned for me, but
not for you.
Looking at your top output, it looks as if you were out of memory and
out of swap.
After reallocating memory, the process size in top would jump to 2* the
reallocated memory size. Then after a time, it would jump back down to
the new reallocated memory size. Then the next realloc() would occur,
repeating the above.
This "doubling" of memory consumption is probably why your test fails
before you reallocate a full 512MB. You don't actually have 150MB of
Though I have not looked at the libc code to understand why realloc() is
behaving this way. A solution could be to either configure more swap
space, or to rewrite the code to use more disk and less memory.