Re: Memory statistics
- From: michael meeks <michael meeks novell com>
- To: David Turner <dturner soremo com>
- Cc: performance-list gnome org
- Subject: Re: Memory statistics
- Date: Mon, 24 Apr 2006 10:40:56 +0100
On Sat, 2006-04-22 at 22:54 +0200, David Turner wrote:
> - due to the way ELF linking works, two identical PLT entries from two
> distinct processes will not necessarily resolve to the same code
> point ! Poof goes our sharing !!
So - another thing worth mentioning; is that each internal symbol that
is not actually used externally and yet is exported adds on x86:
+ (potentially) shared mem: (cf. bfd/elfcode.h & include/elf/external.h)
8bytes of .rel.plt
16bytes of shared .plt entry
16bytes of .dynsym
~<symlen>+1 bytes of .dynstr
+ unshared mem:
4 bytes of un-sharable GOT entry per process
+ CPU:
1000's of cycles to fix-up at 1st call + slowing other lookups
10's of wasted cycles vs. a non-resolved call
So - it is a worthwhile investment ensuring that platform libraries
export as few symbols as they need to.
It also (probably) pays to link with -Bsymbolic to reduce .got size: it
might be interesting to re-link gtk+ etc. with -Bsymbolic & compare
before/after .got sizes to see if it's a substantial 'real' win.
From a memory consumption cost; if you look at:
readelf -rW foo.so | wc -l
In an ideal world[1] each time you shrink the reloc count by ~1024
items you save 1 page of memory per app using the lib [ when fully
linked ;-]. However - as this reveals:
for a in *.so; do num=`readelf -r $a | wc -l`; echo "$num $a"; \
done | sort -n
There are only a few libs in GNOME with large numbers of relocs:
859 libgnomeprintui-2-2.so
883 libgnomecupsui-1.0.so
943 libgda-3.so
947 libgsf-1.so
992 libgnomeprint-2-2.so
1036 libbattstat-applet-2.so
1135 libgconf-2.so
1251 liblinphone.so
1474 libeel-2.so
1565 libgdk-x11-2.0.so
1673 libbonoboui-2.so
1680 libgimpwidgets-2.0.so
1692 libgnomeui-2.so
1730 libgnomedb-3.so
1754 libgstreamer-0.8.so
1919 libwpd-1.so
2296 libgnomevfs-2.so
2358 libgtkhtml-3.8.so
2415 libvte.so
2472 libspi.so
3122 libbonobo-2.so
3382 libORBit-2.so
3404 libgtk-x11-2.0.so
3703 libgal-2.4.so
107798 libgucharmap.so
Not clear to me what libgucharmap is good for ;-)
By contrast (and I have almost no KDE libs on my machine):
1566 libkdeinit_kio_uiserver.so
3200 libkdeinit_cupsdconf.so
6662 libkmedia2_idl.so
7420 libmcop.so
10732 libsoundserver_idl.so
14626 libartsflow.so
19361 libartsflow_idl.so
Or worse for OO.o:
22805 libdbu680li.so
26269 libfrm680li.so
26498 libsvt680li.so
27153 liblocaledata_euro.so
31669 libtk680li.so
43096 libsd680li.so
53147 libsc680li.so
62123 libsw680li.so
79609 libsvx680li.so
;-)
HTH,
Michael.
[1] - assuming all these relocs were to adjacant chunks of memory,
seldom true at least for C++.
--
michael meeks novell com <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]