[BusyBox] #define -> static const int (last call)
Vladimir N. Oleynik
dzo at simtreas.ru
Tue Jan 23 09:06:37 UTC 2001
Mark Whitley wrote:
>
> On Static Buffer Elimination
> ----------------------------
>
> First, some background to put this discussion in context: Static
> buffers look
> like this in code:
>
> /* in a .c file outside any functions */
> static char *buffer[BUFSIZ]; /* happily used by any function
> in this file,
> but ick! big! */
>
> static char *pbuffer
> ...
> other_func()
> {
> strcpy(pbuffer, lotsa_chars); /* happily uses global
> *pbuffer */
> ...
> foo_main()
> {
> char *buffer[BUFSIZ]; /* declared locally, on stack */
> pbuffer = buffer; /* but available globally */
> ...
>
BAD!
System discarding this BSS memory after end usage.
Additional size. Not gain!! Stack is very limited resource.
> $ size busybox-orig
> text data bss dec hex filename
> 237501 29660 65884 333045 514f5 busybox-orig
> $ size busybox-const
> text data bss dec hex filename
> 238157 29692 39964 307813 4b265 busybox-const
> ^^^^^
> yay!
^^^^^^^^^^^^^^ - is interessing. BSS size not interessing.
--w
vodz
More information about the busybox
mailing list