Last data page not being filled

D. J. Bernstein djb@cr.yp.to
Fri Jun 27 11:26:00 GMT 2003


When a program has (to take a real example) 220 bytes of initialized
data and 444 bytes of zero-filled data, the GNU tools put the 220 bytes
into the data segment and the 444 bytes into the bss segment, frittering
away a page of memory per process. They should instead put all 664 bytes
into the data segment.

The general rule is simple: as long as there's something in bss that
fits into the last page of data, move it to the last page of data and
repeat, unless the user explicitly asks for different behavior.

(The reason I care about a page per process is that I'm building systems
on the scale of ten thousand processes. Each process has its own uid,
and memory protection is crucial, so please don't suggest threads.)

---D. J. Bernstein, Associate Professor, Department of Mathematics,
Statistics, and Computer Science, University of Illinois at Chicago



More information about the Binutils mailing list