Ulrich Drepper writes:

> Initializing a variable puts it into the .data
> section while uninitialized variable get stored into .bss.

Wouldn't it be nice if gcc, by itself, would put initialized variables
into BSS if the initializer is entirely zero/null/0.0 ?

> The difference is that variables in .data sections take space in the
> binary and have to be eplicitly loaded while the room for the
> variables in .bss sections is just created.  Not initializing
> therefore descreases load time and increases the amount of VM which
> can be shared between processes.

True. But the amount of VM you can save on non-array variables is
tiny. I did the optimization for libX11. The savings was a few hundred
bytes at most. Given a page size of 4096, this means that it saved the
loading of 1 page from disk with a probability of 10%, and no gain
with a probability of 90%.

Bruno
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to