Subject: Re: Many thanks and a new question...
To: Jeremy Cooper <jeremy@broder.com>
From: Chris G. Demetriou <cgd@pa.dec.com>
List: tech-kern
Date: 07/21/1997 17:38:26
> Finally, MALLOC() is a macro that calls malloc().  You use it to reduce
> the amount of typing needed to make a proper call to malloc(), and to help
> improve memory diagnostics when you compile a kernel with the DIAGNOSTIC
> option.

Not true.

Both malloc and MALLOC will do the same amount of diagnostic checking
if DIAGNOSTIC is defined, etc.

malloc is meant to be a normal function call, used in "non-critical"
paths.

MALLOC is meant to be used in critical paths, where you don't want the
extra overhead that a function call to malloc() might cause.  MALLOC
can expand to a non-trivial amount of inline code, and is best used
with constant allocation sizes.


In general, if you don't know if you should be using malloc or MALLOC,
you should be using malloc.


cgd