The less patch is in.
Rob Landley
rob at landley.net
Sun Sep 18 00:54:40 UTC 2005
On Saturday 17 September 2005 16:06, Rob Sullivan wrote:
You asked about size reduction guidelines. First of all, "make sizes" is your
friend.
> - Replaced the free_flines(), data_readlines(), etc sequence with one
> function: reinitalise().
> *** no effect on size ***
Not having seen what the actual patch was for this change by itself, I have no
idea...
> - Fixed up flag detection to be more Busybox-like.
> *** saves 94 bytes ***
>
> - Changed buffer[100][256] to **buffer and also changed all array
> assignments involving the buffer to
> pointer assignments.
> *** saves 1824 bytes ***
How are you getting these numbers? Running make sizes shows you the actual
sizes of the components. Looking at the .o files or the final binary is
misleading.
> - Changed *flines[MAXLINES] into **flines - this reduces memory usage, but
> does increase the size of
> the less binary somewhat.
> *** adds 2026 bytes ***
Again, not having seen what the actual patch was without the changes all mixed
together, I have no idea what you did.
> The last two changes make me feel a bit nervous - why would changing from
> an array to pointers save or add so much respectively? Perhaps something's
> gone wrong with my flines change...
Most likely the extra size was due to an extra function to be linked in from
libbb, which would already be there with more applets in the binary anyway.
I don't know what you did...
I'm going to check this in before thumping on it myself, but it looks like
you've got a memory leak if anybody calls full_repaint() (which calls
data_readlines() which doesn't free flines[] because reinitialize() is doing
that, but this codepath doesn't go through that...)
Rob
More information about the busybox
mailing list