Quiz Entry - updated: 2026.07.14
What is the .bss section and why does it exist?
.bss holds uninitialized (zero) globals and statics; it takes no space in the file — just a recorded size — and the loader zero-fills it in memory.
* .data carries real bytes on disk; .bss carries only a size — the loader materialises its zeros in memory at startup. *
// Goes in .data
int initialized = 42;
// Goes in .bss
int uninitialized;
// Goes in .bss
static int also_bss;
Why have a separate section?
The .bss section occupies no space in the object file - only the section header records how much memory is needed.
| Section | In file | In memory |
|---|---|---|
| .data | Yes (actual bytes) | Yes |
| .bss | No (just size) | Yes (zeroed) |
Space savings example:
char buffer[1000000]; // 1MB uninitialized
// In .bss: adds ~0 bytes to file
// In memory: 1MB of zeros allocated at load time
The loader:
- Reads .bss size from section header
- Allocates that much memory
- Fills it with zeros
Tip: This is why uninitialized globals are guaranteed to be zero in C - the OS zeros the .bss pages.
Go deeper:
.bss (Wikipedia) — the section that stores a size, not the zeros themselves.