malloc does not return null when out of memory

Darryl Okahata darrylo at
Thu Jul 24 10:34:40 PDT 2003

Andrew Reilly <areilly at> wrote:

> Mike Tancsa wrote:
> >> Ah, the annual "memory overcommit" thread.  I thought we were overdue
> >> for one.
> >
> > But why does the man page for malloc (3) say,
> >
> >     If malloc() fails, a NULL pointer is returned.
> Because that's what happens.  See the subthread with the ulimit examples.

     You know, we could probably eliminate many of these periodic "why
doesn't malloc() return NULL?" threads by simply enhancing the malloc(3)
man page and adding a FAQ entry.

	Darryl Okahata
	darrylo at

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Agilent Technologies, or
of the little green men that have been following him all day.

More information about the freebsd-stable mailing list