Re: http://www.redhat.com/redhat/ (fwd)

Theodore Y. Ts'o (tytso@MIT.EDU)
Tue, 18 Feb 1997 23:17:29 -0500


Date: Tue, 18 Feb 1997 14:27:44 -0700 (MST)
From: Jody Matsushima <matsushj@unidata.ucar.edu>

> We are trying to do some software development on our machine
> that runs RedHat Linux (Intel - Pentium). One of the
> developers has asked me if there is any kind of fix for a
> problem with malloc. The problem seems to be that when you
> use the malloc command, you can allocate memory that is not
> available to allocate. Has anybody else reported this? If
> you need more information, I can get it to you.

This is not a bug; it's a feature. Linux does not do hard allocation of
memory, because its not efficient. A very large amount of memory could
potentially be used is in fact never used. For example, when a process
fork()s, the data pages are not copied right away, but marked
copy-on-write, and only copied when they are modified. If they are
never modified, the extra data page is never needed. If however Linux
were to guarantee that every single memory access was always guaranteed
to succeed, it would have to reserve room for all of those data pages,
even if 99.99999% of the cases they would never be used.

In general, this is very, very, very rarely a problem. It would perhaps
useful for you to comment on *why* you think this is a problem. What is
it specifically that you are trying to do?

- Ted