Re: malloc under linux



jacob navia wrote On 10/03/07 12:39,:
Hi

I was working under linux today when I discovered this:

man malloc

<quote>
[snip pages]

BUGS
By default, Linux follows an optimistic memory allocation strategy.
This means that when malloc() returns non-NULL there is no guarantee
that the memory really is available. This is a really bad bug.
In case it turns out that the system is out of memory, one or more
processes will be killed by the infamous OOM killer. In case Linux is
employed under circumstances where it would be less desirable to
suddenly lose some randomly picked processes, and moreover the kernel
version is sufficiently recent, one can switch off this
overcommitting behavior using a command like
# echo 2 > /proc/sys/vm/overcommit_memory
<end quote>

I just can't believe my eyes.

Old news. In fact, it's Question 7.14 in the FAQ.
See also <http://lwn.net/Articles/104179/>.

--
Eric.Sosman@xxxxxxx
.



Relevant Pages

  • malloc under linux
    ... Linux follows an optimistic memory allocation strategy. ... This means that when malloc() returns non-NULL there is no guarantee that the memory really is available. ... jacob navia ...
    (comp.lang.c)
  • Re: malloc under linux
    ... Linux follows an optimistic memory allocation strategy. ... This means that when malloc() returns non-NULL there is no guarantee ...
    (comp.lang.c)
  • Re: malloc under linux
    ... Linux follows an optimistic memory allocation strategy. ... This means that when malloc() returns non-NULL there is no guarantee ...
    (comp.lang.c)
  • Re: malloc under linux
    ... Linux follows an optimistic memory allocation strategy. ... This means that when mallocreturns non-NULL there is no guarantee that the memory really is available. ... <end quote> ...
    (comp.lang.c)
  • Re: Memory problem
    ... > I test the memory usage with my System Resources Manager and the top ... > command (I work with Linux but the Mac forums are the only place to go ... There are two levels of memory allocation going on here, ... One level is the malloc level, where you can request things in byte-sized ...
    (comp.sys.mac.programmer.help)