[2.4.26] overcommit_memory documentation clarification

From: Vincent Lefevre
Date: Sat May 08 2004 - 19:12:35 EST


Hi,

The documentation of overcommit_memory in Documentation/sysctl/vm.txt
should be clarified, as with the following simple program, malloc()
never returns 0 on an official 2.4.26 kernel, even if overcommit_memory
has been set to 0. Running it has the effect of having random processes
killed, and eventually this process itself.

/* $Id: malloc.c 2753 2004-03-16 15:23:09Z lefevre $
*
* malloc() test
*/

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

#define ONEMB 1048576

int main (void)
{
char *p;
int i;

for (i = 1; (p = malloc(ONEMB)) != NULL; i++)
{
printf ("Got %d MB\n", i);
memset (p, 0, ONEMB);
}
printf ("malloc() failed - OK\n");
return 0;
}

(After some discussions, it appears not to be a bug in the glibc
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=247300>.)

--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/