Re: Out Of Memory in v. 2.1

Stefan Monnier (monnier+lists/linux/kernel/news/@TEQUILA.SYSTEMSZ.CS.YALE.EDU)
04 Oct 1998 20:40:19 -0400


>>>>> "Kurt" == Kurt Fitzner <kf_bulk@nexus.v-wave.com> writes:
> If the allocation functions returned null instead of overallocating, then
> there would be no problem. What's the deal with overallocating anyways...
> did someone figure that most programs allocate memory that they're never
> going to use?

Think about the 1GB temporarily allocated (but not used thanks to COW) when a
512MB process forks to exec /bin/sh.

> So, for a solution, let's do what all programs know how to deal with. Return
> nulls instead of overallocating. No processes need to get killed, and the
> system won't get deadlocked by overallocation.

A first step would probably be to provide logical swap as Irix does: the
overcommitment can be limited to some number of MBs (represented by a
phyisically non-existant logical swap partition).

Furthermore, dealing with malloc->NULL is not enough. A user can then simply
come up with a program that allocates repeatedly in a loop in order to use up
all memory. Next thing you know, the NULL returned from malloc in all other
programs will kill them. Your solution is just very simplistic.

Stefan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/