[BUG] oom killer not triggering in 2.6.9-rc3

Chris Friesen
2004-10-09T00:14:10Z

I have an Xserve running 2.6.9-rc3 and patched to run the ppc kernel rather than
the ppc64 kernel. It's configured with 2GB of memory, no swap.

If I run one instance of the following program, it allocates all but about 3MB
of memory, and the memory hog spins with 100% of the cpu.

If I run two instances of the program, the machine locks up, doesn't respond to
pings, and is basically dead to the world.

Shouldn't the oom-killer be kicking in?

Chris

#include <stdlib.h>
#include <unistd.h>

#define PAGES 1000
#define BLOCKSIZE (pgsz * PAGES)

int main()
{
int pgsz = sysconf(_SC_PAGESIZE);

while(1) {
char *p = (char *)malloc(BLOCKSIZE);
if (p)
for (int i=0;i<PAGES;i++)
*(p+(i*pgsz)) = 1;
}
return 0;
}