Firefox Memory Fragmentation

written by Bjoern Rennhak on November 12th, 2007 @ 11:59 PM

In my daily work I browse a lot. Often I need the net as a big reference manual for many problems I encounter or even just for the daily news. Well, sometimes (or almost always) I end up with more tabs than I actually can manage to read a day.

Now is that not particularly bad as I always keep my workstation running anyways and as a bonus I can continue where I left off my work the following day. Oh, by the way did I mention that my workstation is a dual Xeon (HT) 3.06 Ghz machine with 2.0 GB RAM ? Well, that is one strong machine for such a puny task ! ,,What's your problem'' you probably ask ?

Funny^W thing is that the very next day my System behaves like a good old 486DX and it is utterly impossible to work on the machine. I figured after poking around a bit in the machine that something is really wrong with Firefox. This Article here explains a lot.

It's is pretty sad though if you see an entire 2.0GB of RAM used up by just a couple of browser instances. Hope they can fix it soon, but for now I am off using Opera as I have no time for something that doesn't work.

Here some data which I took at the time...

% vmstat 
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
  3  0 3559244  57068 113760  64044    0    1     1    10    9    4  8  4 87  0


% cat /proc/cpuinfo | grep -i "model name"
model name      : Intel(R) Xeon(TM) CPU 3.06GHz
model name      : Intel(R) Xeon(TM) CPU 3.06GHz
model name      : Intel(R) Xeon(TM) CPU 3.06GHz
model name      : Intel(R) Xeon(TM) CPU 3.06GHz

% cat /proc/meminfo| egrep -i "total|cache"
MemTotal:      2076420 kB
Cached:          65052 kB
SwapCached:     179096 kB
HighTotal:     1179092 kB
LowTotal:       897328 kB
SwapTotal:     4194296 kB
VmallocTotal:   114680 kB

% top -b | head -20
top - 15:01:30 up 11 days, 20:02, 10 users,  load average: 0.97, 1.06, 0.98
Tasks: 233 total,   2 running, 231 sleeping,   0 stopped,   0 zombie
Cpu(s):  8.5%us,  3.9%sy,  0.0%ni, 87.2%id,  0.0%wa,  0.2%hi,  0.1%si,  0.0%st
Mem:   2076420k total,  2020036k used,    56384k free,   114396k buffers
Swap:  4194296k total,  3566232k used,   628064k free,    66248k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        16   0 3058m 1.0g 8876 R   65 52.4   3147:09 firefox-bin                                                                                                                                            
10117 root      15   0 1842m 348m 3348 S   16 17.2   2555:40 Xorg                                                                                                                                                   
    1 root      15   0  2072  612  584 S    0  0.0   0:02.04 init                                                                                                                                                   
    2 root      RT   0     0    0    0 S    0  0.0   0:11.84 migration/0                                                                                                                                            
    3 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0                                                                                                                                            
    4 root      RT   0     0    0    0 S    0  0.0   0:00.44 migration/1                                                                                                                                            
    5 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1                                                                                                                                            
    6 root      RT   0     0    0    0 S    0  0.0   0:00.10 migration/2                                                                                                                                            
    7 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/2                                                                                                                                            
    8 root      RT   0     0    0    0 S    0  0.0   0:00.20 migration/3                                                                                                                                            
    9 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/3                                                                                                                                            
   10 root      10  -5     0    0    0 S    0  0.0   0:01.14 events/0                                                                                                                                               
   11 root      10  -5     0    0    0 S    0  0.0   0:00.41 events/1

% top -b | egrep -i "firefox|%CPU"
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        15   0 3058m 1.0g 8876 R   51 52.4   3147:40 firefox-bin                                                                                                                                            
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        15   0 3058m 1.0g 8876 R   69 52.4   3147:42 firefox-bin                                                                                                                                            
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        16   0 3058m 1.0g 8876 R   60 52.4   3147:44 firefox-bin                                                                                                                                            
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        15   0 3058m 1.0g 8876 R   67 52.4   3147:46 firefox-bin                                                                                                                                            
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                
15956 br        15   0 3058m 1.0g 8876 R   63 52.4   3147:48 firefox-bin
 

% pkill firefox-bin

% vmstat 1 
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0 397416 1610484 114976  75584    0    1     1    10    9    6  8  4 87  0

% *wow* i really need to change my browser :///

Comments

  • Martin Hauser on 13 Nov 16:36

    I totally agree, there is no time for a browser that does not work. And memory fragmentation is a real nasty problem, even more so if you try to port a browser to a machine that has no mmu ... or only 32 mb of main memory. I could sing tailes... anyway. I hope they fix firefox (and some other browsers) soon.
  • Bjoern Rennhak on 13 Nov 23:42

    Sounds like you are having fun at work.. Time to train your users to use lynx ;)
  • Martin Hauser on 14 Nov 04:42

    Agreed, but they are durable and withstanding... have to try something... different... more conviencing ;)
  • MarS on 14 Nov 07:10

    Hi Björn, I agree with the Fragmentation problem, but it's not a big deal and feasible as user by restarting the browser at least once a week. :-) Just kill it directly ("kill -9" or "Force Quit") and, in the next startup, the TabMixPlus Extension offers to recover all open Websites again. (Form content is AFAIR not recovered. But it's never a good idea to leave unsaved data in forms. Save early and often ;-) ) Greetings over the Pacific Ocean from Vancouver to Tokio, :-) MarS
  • Bjoern Rennhak on 15 Nov 00:19

    Hi MarS!

    I used to have the same approach though it is easy it is pretty unnessecary imo. This approach is pretty scary btw. if you have more than 7 FF instances and zillions of tabs :)

    I totally agree with the form content, most of the time though I always just had webpages open…

    Take care…

  • Bjoern Rennhak on 15 Nov 00:22

    I updated some more info on that issue which I had written down earlier...
  • MarS on 16 Nov 09:18

    Update: FF also recovers the form data, after a kill signal :-)

Comments are closed

Options:

Size

Colors