Swap bug in 2.0.35 / 2.0.36pre15

Hubert Tonneau (tonneau.heliosam@hol.fr)
Fri, 30 Oct 1998 12:08:09 +0000


The following program, witch consumes 128 Mb of memory,
will exhaust the 192 Mb (64 Mb physical + 128 Mb swap)
of a box (SMP or not) running a 2.0.35 or 2.0.36-pre15 kernel,
after less than an hour.

As a result, typing 'ls' in another terminal will core dump !

Please notice that everything works fine with the 2.1 kernels.

#include <stdio.h>
#include <stdlib.h>

#define size 128*1024*1024

int r(int range) {
static int seed=8353898;
seed=seed*79353547^38753853;
return (seed>=0 ? seed : -seed)%range; }

main() {
char *mem; char c; int i;
mem=malloc(size);
printf("init\n");
for(i=0; i<size; i++)
mem[i]=r(255);
printf("shake\n");
while(1)
c=mem[r(size)]; }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/