2009-05-09

FireFox memory usage

Lately I tend to suspend my laptop to RAM and reboot/shut it down only when new kernel/dbus or something like that is available. As a side effect I also started closing some programs only when needed. One of these programs is FireFox... Everything was just fine (even nVidia fixed their driver and I see no crashes or screen locks now, yep, I know but I had no choice) but... after a few days the system started getting slower and slower and... I had to find out why!

It took a minute or two before I started htop (you don't use it! really? why?!?) and the problem was very obvious - no free memory - almost all RAM used by FireFox! I have and use the Cache Status Add-on for FireFox, but it helped veeery little. Restarting FireFox was the only thing that really helped. After the restart (hey FF devs, thanks for the 'Show my windows and tabs from last time' option, I love it) it took less than 200MiB RAM. Compared with more than 2 GiB before the restart it makes huuuge diference. The problem may be caused by memory leaks, memory leaks in add-ons, memory fragmentation (a small bit of memory still in use preventing FireFox from returning it to the system, a bit of browsing history for one). Since I can't fix any of these the conclusion is:

If you have FireFox running all the time, set your preferences to 'Show my windows and tabs from last time' and restart it daily... a bit annoying but it works.