Nautilus memory use, part 2

Today I took the memory use analysis from
thursday
and started fixing the things I noticed.

First I changed the text embedded in icons so that we only read 10×5
characters normally, and re-read more only when icons are larger than
“normal”. Then I changed the PangoLayout handling in the icon
container so that PangoLayouts are cached only for icons that are
visible in the view.

I also made the icon cache a bit more aggressive in getting rid of old
old cached icons. We now free most of the cache when Nautilus has been
idle for some time. We didn’t use to do this, which means that the
cache could use quite some memory if the last thing you did was visit
a directory with lots of thumbnailed files.

With the testcase of just starting Nautilus, displaying my homedir in
a spatial icon-view window we had this before:

[alex@greebo tests]$ ./analyze-memdump -s nautilus_before.dat 
total size: 4848501
 unknown type: 1536818
 strings: 904063
 objects: 459112
 slice: 517976
 list headers: 137776
 pixbuf data: 1292756

And, after applying the patches:

[alex@greebo tests]$ ./analyze-memdump -s nautilus_after.dat 
total size: 3787194
 unknown type: 1019389
 strings: 503273
 objects: 452672
 slice: 399168
 list headers: 119936
 pixbuf data: 1292756

So, for this usecase we saved about one megabyte of heap. Not
bad. Furthermore, when you close the window most of the pixbuf data will be freed after a while.

All of this is commited to CVS, please test it out and report any
problems.

If you are interested in the current memory use status you can look at the
resulting
data file
generated after applying all the patches. (Use the
analyzer
app
).

5 Responses to “Nautilus memory use, part 2”

  1. Frank says:

    Good job man, this is what we need, a polished and lite desktop :D

  2. Anonymous says:

    Dunno…I’d prefer a higher memory use if that means that the icon cache has to be rebuilt if I restore a nautilus window that wasn’t active a long time (which means a noticable lag I guess).

  3. Alexander Larsson says:

    Windows are open don’t loose their icons from the cache, independently of how long since they were active, because they reference the pixbuf themselves. This only affects pure cached not-in-use icons.

  4. Ashley Hooper says:

    Thanks so much Alexander! At present I run Enlightenment 16 (with GTK apps) as my computer is not able to run a modern Gnome with reasonable performance. However I would like to run Gnome again in the future – memory use and unnecessary I/O are the clinchers for me. I am following the progress of the optimisation work that yourself, Federico and others are doing with great interest!