[lkml]   [1997]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Memory overcommitting (was Re:
Tuukka Toivonen <> writes:

> As I have understand, Linux returns ALWAYS success when using malloc(),
> because only reason why malloc() would fail, is memory overrun, and this
> will never happen in malloc().

That's wrong. Linux (since 2.0.x, 1.2.x didn't) uses a simple heuristic
to find out if enough memory is available. The other possibility is when
you run into your rlimits.

I really wish people would check the facts before posting.

#include <stdlib.h>
void *p;
p = malloc(1024 * 1024 * 1024); /* allocate 1GB */

printf("p = %p\n", p);

% ulimit -v
% gcc -o overcom overcom.c
% ./overcom


 \ /
  Last update: 2005-03-22 13:39    [W:0.132 / U:5.436 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site