Subject: Re: CVS commit: src/sys/sys
To: David Brownlee <abs@NetBSD.org>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: source-changes
Date: 03/20/2006 08:45:57
David Brownlee wrote:
> On Sun, 19 Mar 2006, Jason Thorpe wrote:
>
>>
>> On Mar 17, 2006, at 3:27 PM, Christos Zoulas wrote:
>>
>>>
>>> Module Name:    src
>>> Committed By:    christos
>>> Date:        Fri Mar 17 23:27:12 UTC 2006
>>>
>>> Modified Files:
>>>     src/sys/sys: malloc.h
>>>
>>> Log Message:
>>> prevent using MALLOC when size is not const.
>>
>> How about just using __builtin_constant_p() and redirecting to
>> malloc() if false?
>
>     As an aside on this, would there be any sense in having an option
>     to build INSTALL and similarly space limited kernels with
>     #define MALLOC=malloc FREE=free?

MALLOC is a big macro.  It really should *only* be used on hot code
paths where performance is critical.  I like the change that makes it
intentionally hard to use.  For 90%ish of cases, malloc() is probably
the better choice.

    -- Garrett

-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191