On 10 Sep 2008, at 00:15, Marco Pesenti Gritti wrote:
> I played some with python -v and got some more data about shell memory
> usage at startup, after taking out gst and numpy.
>> 1)
>> 6.7mb are taken by the following modules, which I don't think we can
> get rid of in any way:
>> import os # precompiled from /usr/lib/python2.5/os.pyc
> import gettext # precompiled from /usr/lib/python2.5/gettext.pyc
> import gtk # directory /usr/lib/python2.5/site-packages/gtk-2.0/gtk
> import gobject # directory
> /home/marco/sugar-jhbuild/install/lib/python2.5/site-packages/
> gtk-2.0/gobject
> import ConfigParser # precompiled from /usr/lib/python2.5/
> ConfigParser.pyc
> import wnck # dynamically loaded from
> /usr/lib/python2.5/site-packages/gtk-2.0/wnck.so
> import dbus # directory /usr/lib/python2.5/site-packages/dbus
> import telepathy # directory
> /home/marco/sugar-jhbuild/install/lib/python2.5/site-packages/
> telepathy
> import hippo # dynamically loaded from
> /home/marco/sugar-jhbuild/install/lib/python2.5/site-packages/hippo.so
> import rsvg # dynamically loaded from
> /usr/lib/python2.5/site-packages/gtk-2.0/rsvg.so
>> 2)
>> If I remove all the sugar code (both shell and toolkit) from the
> complete list of imports we go up to 7.6mb
>> 3)
>> Total memory usage for the running shell is 16.8mb. I think runtime is
> around +1mb compared to import only. (I should verify import only
> though, to be sure).
>> ---
>> So if I my measurements are correct and I'm not missing something:
>> * There is little to gain by trying to strip down dependencies
> further, we have a margin of only 0.9mb.
>> * Importing all the Sugar code takes 8mb. ~5mb of these seem to be
> triggered by the font size computations in sugar.graphics.style. I
> suspect that either this memory will be allocated later lazily when
> starting to render font or it will be freed by the gc (probably a bit
> of both). But we should verify that code carefully and eventually
> figure out why the fonts would be using all of this private memory.
Not sure if this is any help or just muddying the waters, but I
noticed when using pmap on the sugarshell process between 711 and 759
that there is an [anon] block that has increased by 5Mb since 711.
711
[olpc at xo-05-24-02 ~]$ pmap 1676
1676: python /usr/bin/sugar-shell
--- snip ---
0804a000 13888K rw--- [ anon ]
--- snip ---
total 54988K
759
[olpc at xo-05-24-02 ~]$ pmap 1316
1316: python /usr/bin/sugar-shell
--- snip ---
09865000 18996K rw--- [ anon ]
--- snip ---
total 62188K
On cursory glance through the other lib's shown by pmap linked in, I
don't see any obvious monster deltas in 759 vs 711. Sure, most of the
libs seem to have grown a little in size, but the single,
unfortunately opaque, [anon] block seems to hold the majority of
whatever the mem delta between 711 and 759 is (as reported by pmap).
The pmap man page describes the [anon] blocks as: Anonymous memory is
reported for the process heap, stack, for 'copy on write' pages with
mappings mapped with MAP_PRIVATE. Memory not relating to any named
object or file within the file system is reported as [ anon ]. The
pmap command displays common names for cer- tain
known anonymous memory mappings, such as: [ heap ] The process heap.
[ stack ] The process stack. If the common name for the mapping is
unknown, pmap displays [ anon ] as the mapping name.
BTW: pmap listed fonts for the 759 sugarshell process as:
b58f6000 244K r---- /usr/share/fonts/dejavu/DejaVuLGCSansMono-
Bold.ttf
b5933000 60K r---- /usr/share/fonts/kacst/KacstArt.ttf
b5942000 436K r---- /usr/share/fonts/dejavu/DejaVuLGCSans-Bold.ttf
b59af000 264K r---- /usr/share/fonts/dejavu/DejaVuLGCSansMono.ttf
b59f1000 620K r---- /usr/share/fonts/paktype/PakTypeNaqsh.ttf
b5a94000 468K r---- /usr/share/fonts/dejavu/DejaVuLGCSans.ttf
For 711 they were:
b5de0000 408K r---- /usr/share/fonts/dejavu-lgc/DejaVuLGCSans-
Bold.ttf
b5e46000 248K r---- /usr/share/fonts/dejavu-lgc/
DejaVuLGCSansMono.ttf
b5e84000 92K r---- /usr/share/fonts/arabic/KacstQura.ttf
b5ea4000 428K r---- /usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf
Sorry for the noise.
--Gary