[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Reducing libc size
On Tue, Apr 29, 2008 at 08:02:47AM +0100, David Laight wrote:
> No, if you run multiple copies of a static binary the code and readonly
> data are shared between the processes, any data is shared copy-on-write.
> The crunched programs are slightly smaller (since they don't need a PIC
> libc), but the main benefit is the linker selecting the required parts
> of libc for you.
Hmm, I think I got this now. Is there a way I could easily show this
memory saving behaviour in numbers?
Before I started hacking with libc I thought about measuring the memory
consumption, but ended up looking at the /lib/libc.so.12.159 file size
since it was so easy.
But now, if open a few /bin/sh's and a few /rescue/sh's to the background,
load averages: 0.01, 0.06, 0.03 up 0 days, 1:48 07:58:10
9 processes: 4 sleeping, 4 stopped, 1 on CPU
CPU states: % user, % nice, % system, % interrupt, %
Memory: 2376K Act, 20K Inact, 252K Wired, 1284K Exec, 124K File, 44M
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU
3644 root 43 0 88K 712K CPU 0:00 0.00% 0.00% top
0 root 125 0 0K 416K schedule 0:00 0.00% 0.00% [system]
1749 root 85 0 140K 800K wait 0:00 0.00% 0.00% sh
2102 root 85 0 6868K 552K wait 0:00 0.00% 0.00% sh
1 root 81 0 32K 356K wait 0:00 0.00% 0.00% init
3640 root 43 0 140K 752K STOP 0:00 0.00% 0.00% sh
3642 root 43 0 140K 752K STOP 0:00 0.00% 0.00% sh
3641 root 43 0 6868K 520K STOP 0:00 0.00% 0.00% sh
3643 root 43 0 6868K 520K STOP 0:00 0.00% 0.00% sh
Here 140k sized sh's are dynamic /bin/sh's and 6868k sized sh's are
static /rescue/sh's. I suppose SIZE is not important, but does RES contain the
copy-on-write pages shared by a number of processes? If it does the per
process memory usage is not relevat, and I should be looking the total
memory used. Correct?
> For the install ramdisk there are 'small' versions of some functions
> in a separate library - used to avoid getting bloat from libc.
Thanks, I'll have a look at these.
Main Index |
Thread Index |