Subject: Re: MALLOC()
To: None <sommerfeld@orchard.arlington.ma.us>
From: None <itojun@iijlab.net>
List: tech-kern
Date: 08/26/2000 11:57:50
>> >Don't use MALLOC() for variable-sized allocations.
>> sorry for stupid question, could you tell me why?
>Code space. Specifically, look at the BUCKETINDX macro in
><sys/malloc.h>, which expands into a binary search for the right size
>bucket.
>If the size is constant at compile time, BUCKETINDX collapses into a
>compile-time constant, and the MALLOC macro compiles into a relatively
>short code sequence. Otherwise, it explodes into a lot of code..
>Using malloc() instead when the size allocated is variable makes a lot
>more sense.
i see. sorry for stupid question. I was assuming #ifdef DIAGNOSTIC
case for MALLOC().
itojun