Closed Bug 598501 Opened 14 years ago Closed 14 years ago

Memory leaks in Fennec

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: azakai, Assigned: azakai)

References

Details

(Keywords: perf)

1. Load www.cnn.com on Fennec on Ubuntu (Qt build). Wait until loaded.
2. Press reload, wait until loaded, go to step 1.

Each reload raises X.org resident memory (not virtual - resident) by 250 MB (!)

Closing Fennec releases the X.org memory, but closing the tab or browsing to another website does not help.
tracking-fennec: --- → ?
On a GTK build it seems that memory usage rises by 110MB per reload.
It also cause a massive increase in xorg. Keyevents are super slow processed (around 10 seconds for one).
I also noticed that Xorg is using huge amount of memory, when I try to pan the page on desktop Qt fennec.

Here is the output from the memory usage monitoring tool:
-----------------
System total memory: 3094632 kB RAM, 1951856 kB swap
________ __________________ ___________ _______________________________
        |  system memory   |system CPU |PID 887 X :0 -nr -verbose -aut>
   time:|     used: change:|    %: MHz:|  clean:  dirty: change: CPU-%:
14:53:37     840192      +0   0.0%    0     4160  142768      +0   0.0%
14:53:40     856948  +16756  32.0%    0     4156  142772      +4   1.5%
14:53:43     860344   +3396  57.2%    0     4408  142576    -196   2.1%
14:53:46     859032   -1312  53.0%    0     4408  142576      +0   1.1%
14:53:49     872360  +13328  58.5%    0     4852  142232    -344   2.9%
14:53:52     904104  +31744  28.2%    0     4852  142232      +0   1.1%
14:53:55     903848    -256  19.2%    0     4852  142240      +8   0.8%
14:53:58    1229792 +325944  50.4%    0     4844  451656 +309416  14.8%   -> Load news.google.com
14:54:01    1229756     -36   5.1%    0     4844  451656      +0   0.3%
14:54:04    1230084    +328   5.8%    0     4860  451640     -16   0.8%
14:54:07    1808524 +578440  44.9%    0     4860 1028212 +576572  34.7%   -> Start panning
14:54:10    2184392 +375868  46.9%    0     4860 1403420 +375208  39.1%
14:54:13    2695324 +510932  46.6%    0     4860 1915996 +512576  40.7%
14:54:16    3060572 +365248  55.6%    0     4852 2278620 +362624  45.5%
14:54:19    3415840 +355268  56.8%    0     4856 2633544 +354924  20.5%
14:54:22    3499004  +83164  68.5%    0     4708 2715192  +81648   2.9%
14:54:25    3605308 +106304  91.5%    0     4428 2820264 +105072   4.6%
14:54:28    3627384  +22076 100.0%    0     4124 2840304  +20040   1.4%   
14:54:31    3628032    +648 100.0%    0     4124 2841956   +1652   0.2%
14:54:34    3626704   -1328 100.0%    0     4128 2841952      -4   0.2%
14:54:37    3639796  +13092 100.0%    0     4140 2854444  +12492   0.5%  
14:54:40    3639724     -72 100.0%    0     4136 2854428     -16   0.5%   -> Stop panning
14:54:43    3639012    -712  82.1%    0     4152 2854412     -16   0.8%
14:54:46    3639956    +944  90.7%    0     4312 2854252    -160   3.1%
14:54:49    3639512    -444  89.6%    0     4420 2854144    -108   0.5%
14:54:52    3635692   -3820  93.5%    0     4604 2848980   -5164   0.5%    
14:54:55    3634608   -1084  80.4%    0     4604 2848980      +0   0.2%
14:54:58    3634660     +52 100.0%    0     4644 2848956     -24   0.2%
14:55:01    3633224   -1436 100.0%    0     4644 2848956      +0   0.0%
14:55:04    3633296     +72 100.0%    0     4724 2848880     -76   0.0%
14:55:07    3636396   +3100 100.0%    0     4852 2853728   +4848   0.5%
14:55:10    3636740    +344 100.0%    0     4852 2853728      +0   0.0%
14:55:13    3637084    +344 100.0%    0     4912 2853668     -60   0.5%
14:55:16    3631964   -5120  98.8%    0     4948 2848652   -5016   0.8%
14:55:19    3630624   -1340  90.7%    0     4972 2848628     -24   0.3%
14:55:22    3631352    +728  99.8%    0     5104 2848496    -132   0.2%
14:55:25    3625928   -5424  71.6%    0     5116 2848484     -12   0.2%
14:55:28    3626144    +216  96.9%    0     5128 2848472     -12   0.5%
14:55:31    3627092    +948  91.2%    0     5156 2848444     -28   0.6%
14:55:34    3627844    +752  87.4%    0     5160 2848440      -4   0.6%
14:55:37    3629848   +2004  67.9%    0     5164 2848440      +0   2.3%
14:55:40    3626928   -2920  90.6%    0     5160 2848452     +12   0.7%
14:55:43    3627208    +280 100.0%    0     5176 2848436     -16   1.1%
14:55:46    3628076    +868  99.3%    0     5180 2848432      -4   0.0%
14:55:49    2206180-1421896  99.8%    0     5084 1463084-1385348   2.3%  -> Close Fennec
14:55:52     878236-1327944  65.0%    0     4960  142072-1321012   3.1%
14:55:55     830876  -47360  62.4%    0     4928  137128   -4944   1.8%
14:55:58     832468   +1592   9.2%    0     4940  137116     -12   1.6%
14:56:01     832028    -440  18.1%    0     4952  137104     -12   1.6%
I took a website with only one input field in it, clicking in this field and the - xorg memory consumption is exploding. In 10 seconds ~200-300M.

A more detailed investigation showed that simple zooming is causing a constant increase of memory. And the blinking of the caret does the rest.
(In reply to comment #4)
> I took a website with only one input field in it, clicking in this field and
> the - xorg memory consumption is exploding. In 10 seconds ~200-300M.
> 
> A more detailed investigation showed that simple zooming is causing a constant
> increase of memory. And the blinking of the caret does the rest.

I don't see this with google.com (focusing in the search box and letting the cursor blink). What website did you see this on?

I also see no memory change when reloading google.com. It just seems to happen on image-heavy websites like cnn.com, also icanhascheezburger.com
Rebuilding right now, I see no effect before hitting reload about 10 times. Then +50MB per additional reload.

mbrubeck cannot reproduce this at all.

Very odd.
When using raster it seems to be gone, using native rendering is eating memory like nothing - esp. when you zoom, or a caret is blinking.
(In reply to comment #7)
> When using raster it seems to be gone, using native rendering is eating memory
> like nothing - esp. when you zoom, or a caret is blinking.

How are you switching between native and raster?
in qt i can just say    -graphicssystem native   or -graphicssystem raster,   in case i set nothing its native by default.

with e10s i need to set that also on the content process by exporting Graphicssystem Env Variable.
jbos, thanks!

I can confirm what jbos says, running with

  export MOZ_QT_GRAPHICSSYSTEM=native ; ./fennec www.cnn.com

(or without any export) will trigger the bug (namely, after ~10 reloads of cnn.com, X.org resident memory starts to rise, about 50MB per additional reload). Whereas with

  export MOZ_QT_GRAPHICSSYSTEM=raster ; ./fennec www.cnn.com

no bug is encountered.

So, must be a bug in our interaction with Qt. Oleg, any thoughts?
tracking-fennec: ? → 2.0+
Assignee: nobody → azakai
tracking-fennec: 2.0+ → 2.0b3+
alon, can you see if gtk and android have this same problem?
gtk has a similar problem, but less significant. It's also less significant on Qt now than it was before.

The issue might be due to various memory leaks we have, found 1 so far (bug 609678), at least 1 left.
Depends on: 609752, 609678
Summary: Reloading cnn.com increases X memory quickly and without limit → Memory leaks in Fennec
With the fixes in the two dependant bugs, there is no longer a leak on reloading cnn.com - memory usage rises, 75 to 105MB on a desktop build, but stabilizes at that point. Further reloads do not increase it.
Any reason this bug blocks b3?  Seems like it has evolved into a tracking bug.
right, tracking bugs don't block.
tracking-fennec: 2.0b3+ → ---
This bug has reached the end of its usefulness.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.