Comments on svn 16057.

Rich Felker dalias at aerifal.cx
Thu Sep 7 01:39:39 UTC 2006


On Wed, Sep 06, 2006 at 01:51:36PM -0400, Rob Landley wrote:
> http://busybox.net/downloads/patches/svn-16057.patch
> 
> RESERVE_CONFIG_BUFFER() is actually a bit of a dinosaur.  It turns out that 
> most of the times I've tested, declaring a pointer and using xmalloc() (or 
> xzalloc()) actually results in smaller code.  (On x86 anyway.)  And the only 
> reason for declaring stuff on the stack was that it was theoretically 
> smaller...
> 
> And in this particular case, xzalloc() saves the calls to memset().
> 
> I'm considering removing RESERVE_CONFIG_BUFFER() and just using malloc() when 
> it makes sense and declaring stuff on the stack when it makes sense.  Anybody 
> have any opinions on this?  If nothing else it simplifies the code...

Personally I dislike malloc, but the concrete savings from omitting
malloc come only when you can prevent malloc from being used entirely
(to avoid linking it and to avoid initializing the data structures and
doing the initial brk increase), and I don't think there's any way to
do that in BB. Most of my preference for stack is just ideological and
there's not a lot of friendliness to ideological considerations here
(for good reason of course). Do what you like.

Rich




More information about the busybox mailing list