Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!unmvax!uokmax!servalan!rmtodd From: rmtodd@servalan.uucp (Richard Todd) Newsgroups: comp.unix.wizards Subject: Re: Shared libraries (was Re: Window system bashing (was Re: X11 bashing)) Message-ID: <1991Apr19.005739.2321@servalan.uucp> Date: 19 Apr 91 00:57:39 GMT References: <26550@adm.brl.mil> <97@titccy.cc.titech.ac.jp> <1991Apr17.020930.25198@NCoast.ORG> <112@titccy.cc.titech.ac.jp> <117@titccy.cc.titech.ac.jp> Organization: Ministry of Silly Walks Lines: 67 mohta@necom830.cc.titech.ac.jp (Masataka Ohta) writes: > mohta@necom830.cc.titech.ac.jp (Masataka Ohta) writes: >>You may claim shared libraries reduces the amount of required memory. >>But, even if you run all the command at the same time, total code >>space consumed is only 24884KB (including non-library code). On the >>other hand, if you run single X11 application, with shared library, >>mere /lib/X11.a consumes 3.3MB of virtual (and often real, as libraries >>tends to be scattered) memory. 3.3 MEG??? That seems to me to be *way* out of line with what I see. Here's what the shared library module for libX11 is like on my system (Mac IIx, 68030 based machine, X11R4 compiled with gcc and Coolidge's shared library patches.) libX11_s is the actual shared library object file that's mapped into the address space of any X client that wants to use the shared lib: % ll /usr/lib/X11/shlib/libX11_s 27930 488 -rwxr-xr-x 1 root root 244027 Mar 25 20:19 /usr/lib/X11/shlib/libX11_s* And that's an unstripped binary; the actual size is: % size -d /usr/lib/X11/shlib/libX11_s Size of /usr/lib/X11/shlib/libX11_s: 141280 Section Size Physical Address Virtual Address .text 107656 1240465408 1240465408 .data 28980 1240989696 1240989696 .bss 4644 1241018676 1241018676 That means that worst case, Xlib will take up ~120K of memory. That's *120K*, not 3.3M. You're off by a factor of 30. (Even if we throw in libXt, libXmu, and libXaw, that's still a total of only 483K, still a far cry from 3.3M.) If standard MIT Xlib really compiles out to 3.3M on your SONY NEWS workstation, remind me not to buy one to replace my Mac.... >If you run mwm, xdm and as many xterms as you want, > text data bss dec hex > 1007616 192512 27168 1227296 12ba20 /usr/bin/X11/mwm > 413696 86016 27792 527504 80c90 /usr/bin/X11/xdm > 585728 139264 39376 764368 ba9d0 /usr/bin/X11/xterm >still, total text size is below 2MB. Well, I don't have mwm (not being willing to pay OSF one grand to make my windows look really ugly :-), but let's look at the memory sizes on my Mac: text data bss total xterm: 146776 55804 32156 234736 xdm: 111004 27568 25272 163844 tvtwm: 150468 29884 30964 211316 So if we've got one of each client going (or more, considering that in any decent Unix implementation the text is shared, and the data&bss usage for these programs is considerably smaller than the text space), we've got ~600K for the clients + ~480K for the shared libs, and add maybe 1M for the server, and we've got a total memory usage for X of ~2M. Not exactly slim, but better than the 3.3M you were claiming for just the libraries alone. >So, shared library is NO solution even to reduce memory consumption of X11. Seems to be doing good on my computer. And even leaving aside memory considerations, compiling the entire X11R4 core client distribution with shared libraries saved over 4M in disk space, just in not requiring every client to contain a copy of the libraries. (There are a *lot* of clients in the std. X11R4 distribution...) -- Richard Todd rmtodd@uokmax.ecn.uoknor.edu rmtodd@chinet.chi.il.us rmtodd@servalan.uucp "Elvis has left Bettendorf!"