Re: Debian shared libs use far more memory than required
Andreas Barth wrote:
> > DEBIAN PACKAGE FROM REPOSITORY:
> > 11 .rodata 000840cb 000000000021a180 000000000021a180 ...
> > 21 .data 000233c0 00000000003f1d60 00000000003f1d60 ...
> > MY OWN RECOMPILED DEBIAN PACKAGE:
> > 11 .rodata 000a43ad 00000000001f3180 00000000001f3180 ...
> > 21 .data 00000748 00000000003f3460 00000000003f3460 ...
> > That's 0x0233c0-0x748 = 140KB moved from shared to non-shared
> > 140KB of non shared memory per GTK application is HUGE!!!
Fortunately it is not as bad as it sounds iff the constant data is
collated together in larger chunks. The kernel does copy-on-write,
if a .data page is never written, the memory usage is effectively
> > My first though was that the official debian package was probably
> > compiled with a different version of gcc.
> > However, I could not reproduce the official package size with gcc-3.3,
> > gcc-3.4 and gcc-4.0 so the problem
> > is probably elsewhere: libtool? binutils ?
The immediate suspect is binutils, particularily ld. It might be
interesting to do test compiles with an older binutils version
(2.15 vs. 2.16?) and see if the problem is reproducible.