This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Last data page not being filled
- From: "D. J. Bernstein" <djb at cr dot yp dot to>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2003 07:08:45 -0000
- Subject: Last data page not being filled
- Automatic-legal-notices: See http://cr.yp.to/mailcopyright.html.
When a program has (to take a real example) 220 bytes of initialized
data and 444 bytes of zero-filled data, gcc puts the 220 bytes into the
data segment and the 444 bytes into the bss segment, frittering away a
page of memory per process. It 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 -fminimize-data is specified.
(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