Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235930 - mozilla-firefox large memory footprint, while mozilla-firefox-bin is much smaller
Summary: mozilla-firefox large memory footprint, while mozilla-firefox-bin is much sma...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-27 16:31 UTC by devsk
Modified: 2008-08-28 20:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2008-08-27 16:31:43 UTC
If I run firefox from mozilla-firefox, with the same set of tabs and refreshes (yahoo mail, google mail, gentoo forums etc.), firefox starts to breach 350MB.
If I run mozilla-firefox-bin, I never breach 250MB (avg around 200MB). Another thing I noticed is that there is a leak, mozilla-firefox just keeps growing and mozilla-firefox-bin doesn't.

This is on two different machines running x86. Both MOZ_DISABLE_PANGO values give the same result.

$ emerge -pv mozilla-firefox

These are the packages that would be merged, in order:

Calculating dependencies ... done!
[ebuild   R   ] www-client/mozilla-firefox-3.0.1  USE="dbus gnome java -bindist -custom-optimization -iceweasel -ipv6 -mozdevelop -restrict-javascript -startup-notification -xulrunner" LINGUAS="en -af -ar -be -ca -cs -da -de -el -en_GB -en_US -es -es_AR -es_ES -eu -fi -fr -fy -fy_NL -ga -ga_IE -gu -gu_IN -he -hu -id -it -ja -ka -ko -ku -lt -mk -mn -nb -nb_NO -nl -nn -nn_NO -pa -pa_IN -pl -pt -pt_BR -pt_PT -ro -ru -si -sk -sl -sq -sr -sv -sv_SE -tr -uk -zh -zh_CN -zh_TW" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

$ emerge -pv mozilla-firefox-bin

These are the packages that would be merged, in order:

Calculating dependencies ... done!
[ebuild   R   ] www-client/mozilla-firefox-bin-3.0.1-r1  USE="-restrict-javascript" LINGUAS="en -af -ar -be -ca -cs -da -de -el -en_GB -en_US -es -es_AR -es_ES -eu -fi -fr -fy -fy_NL -ga -ga_IE -gu -gu_IN -he -hu -id -it -ja -ka -ko -ku -lt -mk -mn -nb -nb_NO -nl -nn -nn_NO -pa -pa_IN -pl -pt -pt_BR -pt_PT -ro -ru -si -sk -sl -sq -sr -sv -sv_SE -tr -uk -zh -zh_CN -zh_TW" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

I did a about:builconfig in both:
mozilla-firefox:
Build platform
target
i686-pc-linux-gnu

Build tools
Compiler        Version         Compiler flags
i686-pc-linux-gnu-gcc   gcc version 4.3.1 (Gentoo 4.3.1-r1 p1.1)        -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -W -Wno-long-long -march=k8 -pipe -Wno-return-type -w -fno-strict-aliasing -pthread -pipe
i686-pc-linux-gnu-g++   gcc version 4.3.1 (Gentoo 4.3.1-r1 p1.1)        -fno-rtti -fno-handle-exceptions -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-long-long -march=k8 -pipe -Wno-return-type -w -fno-strict-aliasing -fshort-wchar -pthread -pipe -DGENTOO_NSPLUGINS_DIR=\"/usr/lib/nsplugins\" -DGENTOO_NSBROWSER_PLUGINS_DIR=\"/usr/lib/nsbrowser/plugins\"

Configure arguments
--enable-application=browser --enable-optimize --disable-installer --disable-pedantic --enable-crypto --with-system-jpeg --with-system-zlib --disable-updater --enable-default-toolkit=gtk2 --enable-pango --enable-svg --enable-svg-renderer=cairo --enable-system-cairo --disable-strip --disable-strip-libs --disable-install-strip --with-distribution-id=org.gentoo --enable-single-profile --disable-profilesharing --disable-profilelocking --enable-default-toolkit=cairo-gtk2 --disable-ipv6 --disable-startup-notification --disable-freetype2 --disable-debug --disable-tests --enable-reorder --enable-elf-dynstr-gc --disable-mailnews --disable-mochitest --disable-crashreporter --enable-system-hunspell --enable-image-encoder=all --enable-canvas --with-system-nspr --with-system-nss --enable-system-lcms --enable-oji --enable-mathml --enable-storage --enable-places --enable-places_bookmarks --with-default-mozilla-five-home=/usr/lib/mozilla-firefox --enable-official-branding --enable-extensions=default,typeaheadfind,-venkman --prefix=/usr --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --build=i686-pc-linux-gnu --disable-static 

mozilla-firefox-bin: 
Build platform
target
i686-pc-linux-gnu

Build tools
Compiler        Version         Compiler flags
/tools/gcc/bin/gcc      gcc version 4.1.2 20061011 (Red Hat 4.1.1-29)   -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -W -Wno-long-long -pedantic -gstabs+ -fno-strict-aliasing -pthread -pipe
/tools/gcc/bin/g++      gcc version 4.1.2 20061011 (Red Hat 4.1.1-29)   -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-long-long -pedantic -gstabs+ -fno-strict-aliasing -fshort-wchar -pthread -pipe

Configure arguments
--enable-application=browser --enable-update-channel=release --enable-update-packaging --enable-optimize --disable-debug --disable-tests --enable-official-branding 

The rendering test at http://scragz.com/archived/mozilla/test-rendering-time is a sure way of making firefox consume large amounts of memory. In case of mozilla-firefox, the memory jumps from 254MB to 343MB during rendering in 3.338 seconds. In case of mozilla-firefox-bin, the memory jumps from 205MB to 242MB (settles to this value after few seconds) in 3.365 seconds.

So, rendering is not that much faster but it sure is a memory hog. What's the default renderer for firefox? Gentoo is selecting cairo-gtk2 based on my useflags.

I think many people running gentoo might be inadvertently running into this and just blaming firefox for being a hog, whereas the trouble might be in cairo/gtk2 libraries.
Comment 1 devsk 2008-08-27 16:35:55 UTC
when I said "memory", I meant RES column of 'top' output. The numbers I quoted are after "settling period of about 30 seconds" because firefox has this new feature of cleaning its used memory periodically.
Comment 2 Carsten Lohrke (RETIRED) gentoo-dev 2008-08-27 16:44:11 UTC
Mozilla profiles the code, uses distinct compiler flags for certain pats of the code and knows exactly, which code better not to optimize. Also, building is only one part, but moreso your configuration - caching more website data requires more memory. Another issue may be improper calculation of the used memory, as the data of free, top, ps, etc. do not reflect the real memory usage.

Most likely what you're noticing is a non-issue.
Comment 3 Raúl Porcel (RETIRED) gentoo-dev 2008-08-27 16:59:57 UTC
Nothing we can do.
Comment 4 devsk 2008-08-27 17:14:34 UTC
(In reply to comment #2)
> Mozilla profiles the code, uses distinct compiler flags for certain pats of the
> code and knows exactly, which code better not to optimize. Also, building is
> only one part, but moreso your configuration - caching more website data
> requires more memory. Another issue may be improper calculation of the used
> memory, as the data of free, top, ps, etc. do not reflect the real memory
> usage.
> 
> Most likely what you're noticing is a non-issue.
> 

I am sorry. How is it a non-issue? I said its the same number of tabs, same set of tabs (restored using "open my windows from last time" option) in a steady state observed over a period of time (many days) using a tool which reflects resident memory of the process. I think its not about code optimization. I think most likely its about specific config selection as opposed to the default selection.

I know about caching and how to interpret values reported by free. So, please don't brush it over as non-issue. I have to restart firefox often because of this because I have some 30 tabs open all the time. It is a real issue with the way gentoo is setting up the build config. And as the rendering test indicated, its something to do with our default toolkit selection and/or rendering engine. If we can figure that that is the case, we can pursue that further. But someone has to help understand this problem better.

BTW, I have observed this behavior on multiple x86 boxes.

(In reply to comment #3)
> Nothing we can do.
> 

Yes, we can. If we find that cairo is the culprit, we can just use the default renderer as a workaround. We don't even know where the problem is coming from at this time. How can we say we can't do anything? Please work with me here. Its a genuine problem. I wouldn't file a bug just like that. Many people might be seeing it but brushing it over as "ohh, firefox is a hog!"
Comment 5 Raúl Porcel (RETIRED) gentoo-dev 2008-08-28 17:46:44 UTC
(In reply to comment #4)
> Yes, we can. If we find that cairo is the culprit, we can just use the default
> renderer as a workaround. We don't even know where the problem is coming from
> at this time. How can we say we can't do anything? Please work with me here.
> Its a genuine problem. I wouldn't file a bug just like that. Many people might
> be seeing it but brushing it over as "ohh, firefox is a hog!"
> 

Well, feel free to work on it...
Comment 6 devsk 2008-08-28 20:07:01 UTC
I did find that if I hack the ebuild to run configure with options from the about:buildconfig of the mozilla-firefox-bin version, its not leaky anymore but the configure options list is too large to conclude which of those is responsible for memory consumption by exclusion: it takes a long time to build mozilla-firefox. So, I give up and learn to like the -bin version....:-)