[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.018 / U:16.416 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site