public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.4.26] overcommit_memory documentation clarification
@ 2004-05-09  0:10 Vincent Lefevre
  2004-05-09  2:04 ` Richard B. Johnson
  0 siblings, 1 reply; 10+ messages in thread
From: Vincent Lefevre @ 2004-05-09  0:10 UTC (permalink / raw)
  To: linux-kernel

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@vinc17.org> - 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-05-27 21:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-09  0:10 [2.4.26] overcommit_memory documentation clarification Vincent Lefevre
2004-05-09  2:04 ` Richard B. Johnson
2004-05-09  2:20   ` Vincent Lefevre
2004-05-09 21:06     ` Paul Jackson
2004-05-09 21:49       ` Vincent Lefevre
2004-05-27 12:20         ` Marcelo Tosatti
2004-05-27 12:30           ` Marc-Christian Petersen
2004-05-27 13:09             ` Marcelo Tosatti
2004-05-27 13:19               ` Dave Jones
2004-05-27 21:12               ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox