Memory leak ?

User Help for Mozilla Firefox
Locked
Xymox1
Guest

Memory leak ?

Post by Xymox1 »

I have noticed that as I browse Firefox consumes loads of memory based on pictures on the web pages.

This caching seems completly unchecked. I recently noticed my computer had slowed down a whole lot and looked at ram usage and discovered that Firefox was consuming a whopping 310MB of system ram.

Looking to the problem it was clear that Firefox NEVER gives up the ram used for caching pictures and page data.

Restarting the browser fixes this.

In contrast Internet Explorer manages the amount of system ram used.

I looked for a setting for ram caching and could not find one.

I need to limit it to,say, 25MB.

Im running 1.0 and I have this problem with no extensions and in safe mode.

It seems that Firefox will continue to consume memory forever making the system unstable.

I need a memory management solution as I cannot ever go back to IE.
User avatar
LeRoi
Moderator
Posts: 10346
Joined: September 15th, 2003, 10:22 am

Post by LeRoi »

type about:config into the location bar, press enter, right click any line, choose "new">"integer", paste this into the dialogue that appears:

browser.cache.memory.capacity

click okay, specify the amount in kb in the next dialogue that appears, restart firefox.
fnkmaster
Posts: 1122
Joined: November 21st, 2002, 1:18 pm

Post by fnkmaster »

Agreed, this is an issue - in *theory*, Firefox is supposed to use as much RAM as you have available, but let it go when another application needs it. In practice, I find FF is not too great about being well behaved - when memory usage gets too large, it seems to sluggify things a bit. Luckily, the fix is trivial and after doing this, I have had no more problems with FF eating up RAM.

Open (or create if it doesn't exist yet) a text file called user.js in your profile folder. Paste in the following line:

user_pref("browser.cache.memory.capacity", 16000);

Gives FF 16 megs of memory cache to play with, which is fine in my view, anything beyond that it can cache to disk. Hopefully they'll put this limit in the GUI by the disk cache control in FF 1.1 because it's a rather important setting to be able to tweak, IMHO. Nowadays, even after a day or two of heavy browsing, my total FF memory usage never gets too large for me.

Edit: Yeah, do it the way LeRoi suggested, that's easier that editing user.js manually.
User avatar
Lee_Dailey
Posts: 14194
Joined: July 27th, 2004, 4:33 pm
Location: milky way galaxy, sol system, terra, north america, usa, tx, bedford

Re: Memory leak ?

Post by Lee_Dailey »

Xymox1 wrote:I have noticed that as I browse Firefox consumes loads of memory based on pictures on the web pages.

This caching seems completly unchecked. I recently noticed my computer had slowed down a whole lot and looked at ram usage and discovered that Firefox was consuming a whopping 310MB of system ram.

Looking to the problem it was clear that Firefox NEVER gives up the ram used for caching pictures and page data.

Restarting the browser fixes this.

In contrast Internet Explorer manages the amount of system ram used.

I looked for a setting for ram caching and could not find one.

I need to limit it to,say, 25MB.

Im running 1.0 and I have this problem with no extensions and in safe mode.

It seems that Firefox will continue to consume memory forever making the system unstable.

I need a memory management solution as I cannot ever go back to IE.


howdy xymox1,

yes, a memory prob exists. part of it - the part that is caused by display leaks, mostly - will get partly fixed when ff goes to version 1.1 and starts using the newer gecko display stuff in version 1.8x of the mozsuite.

if you lookit the user agent string - the last two lines of the help/about-mozilla-firefox dialog - you will see somethng like this ...
Mozilla/5.0 (Windows; U; Win98; rv:1.7.3) Gecko/20040913 Firefox/0.10.1

note the "rv:1.7.3" indicates that my firefox is based on the mozsuite version 1.7.3 code.

for now, minimizing and then mazimizing ff will SOMEtimes flush part of the display memory. [*grin*] not a nice solution. not even a very effective one.

btw, the display memory use that you are seeing is not related - directly - to the ram cache. [*sigh ...*] sorry.

take care,
lee
Guest
Guest

Post by Guest »

OK..

So if I have a disc caching program, Supercache by Superspeed, should I just turn off memory caching ?

Cache.memory.enable False ?
fnkmaster
Posts: 1122
Joined: November 21st, 2002, 1:18 pm

Post by fnkmaster »

I would strongly recommend against turning it off entirely, you'll notice a substantial performance hit in Firefox (I tried it once for about 10 minutes, and turned it right back on). Even giving FF a few megabytes of in-memory cache is usually fine for most purposes.

Disk caching programs like supercache speeds up your hard drive performance in general, but doesn't replace in-memory caching for your browser, and you'll still notice the performance hit I mention.
Guest
Guest

Post by Guest »

However is the disk becomes 100% ram based speed wise, do I need memory cache ?

You see my point ?

If ff runs completly out of ram with Supercache, why do I need a additional ram cache if everything is in cache ram already ?

I will try turning it off and see. I will report back on my results.

The fix mentioned above limiting cache usage does work.
Guest
Guest

Post by Guest »

After short trials with ram caching off I do not see any performance hit. This is obviously because of my use of Supercache. So, don't try this at home folks. Besides you need Win 2K to run Supercache.

I will continue testing and report more.

Obviously disc caching needs to stay on, but Ram caching can go bye bye for me.
Guest
Guest

Post by Guest »

After more experence with it......

Firefox does perform more slowly turning memory cache off. In fact some pages would hang and not load.

As Firefox was running 100% inimemory at all times this was a tad unexpected.

Possibly turning off memory caching forces Firefox to load everything from the net rather then looking in disc cache or memory cache ?

Anyway...

By setting Firefox to 16MB of memory cache and using Supercache I have improved performance quite a bit and Firefox no longer keeps consuming memory endlessly.

Thanx !
fnkmaster
Posts: 1122
Joined: November 21st, 2002, 1:18 pm

Post by fnkmaster »

Guest: I warned you about turning it off entirely. :) Anyway, like I said, 16 megs seems to be a happy setting for Firefox, performance is good, memory usage is reasonable for most modern PC configurations, and I think the marginal benefit above that isn't too great for most users. Firefox works great for me at this setting on several computer with 256-512 megs of RAM, and never seems to eat too much memory.
sbc
Posts: 147
Joined: February 18th, 2004, 12:47 pm

Post by sbc »

Seems to ignore browser.cache.memory.capacity for me (even after restarting) - goes over 26MB usage.

Memory/CPU usage seems to be a problem with some users. I do find CPU usage can go to 99/100%, and when viewwing pages with embedded images/movies/flash it does tend to get a bit slow (scrolling especially). It is not like that for everyone, but at the moment IE is generally faster with embedded content (although I don't use it much).
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
User avatar
LeRoi
Moderator
Posts: 10346
Joined: September 15th, 2003, 10:22 am

Post by LeRoi »

Type about:cache into the location bar and press enter, what does it list as memory cache capacity?

26MB is not very high memory usage in my opinion. That's about what FF averages on my system, right now it's at 22.6MB.

You could use userContent.css to filter a lot of those flash (and other) ads.

I use basic ad blocking lines from here:

gozer.org: Mozilla: Ad Blocking

and rarely see an ad, flash or otherwise.
sbc
Posts: 147
Joined: February 18th, 2004, 12:47 pm

Post by sbc »

It lists the right size in there:
Number of entries: 237
Maximum storage size: 20000 KiB
Storage in use: 3072 KiB
Inactive storage: 2003 KiB

But this is completely different to what you see in task manager processes. Shouldn't they be the same? Or is memory cache completley different to memory usage (i.e. you can't limit memory usage).

26mb is not a lot, but it seems to run OK at that level, and I want to prevent it from going too much over that (have seen it use 200MB with 100% CPU usage).

It would be good if you could somehow catch memory leaks (i.e. if memory usage is constantly going up even though you are not downloading).
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
fnkmaster
Posts: 1122
Joined: November 21st, 2002, 1:18 pm

Post by fnkmaster »

sbc: Task manager memory usage includes both the overhead memory used for the Firefox application executable code, data structures, parsing and rendering, as well as cache, so it will be by definition higher than the maximum cache size. It's generally impossible to say to any application "don't use the overhead memory you use for other stuff". So if you set FF to use a maximum 8 or 16 meg cache, it's size can still get to 40 or 50 megs quite easily, especially with many windows or tabs open. But this doesn't present a problem on any modern PC with 256+ megs of RAM. If you are running with 128 megs of RAM, you probably want to set the max cache size much smaller, like 2 or 4 megs. And honestly if you only have 64 megs of RAM, I can't imagine FF being a great choice for you, especially not if you are going to use tabbed browsing. But there's really no excuse for having so little RAM in this day and age (the official system requirements for Firefox say 64 megs required, 128 megs recommended).

The point is to prevent FF from getting to 100 or 200 megs of persistent memory usage, which generally happens when large amounts of content get cached in memory (usually this happens on systems with lots of memory, where the dynamic cache sizing algorithm decides that since you have 400 megs of available, unused RAM, it ought to be able to use 300 of that if it wants to).
User avatar
LeRoi
Moderator
Posts: 10346
Joined: September 15th, 2003, 10:22 am

Post by LeRoi »

Memory usage by the cache is different from what the whole program uses. Depends a lot on the complexity of the particular theme and combination of extensions (and their configurations) you use.

I've believed for quite a while that Windows is not at all good at managing memory without some help. I use a program called Cacheman that makes it easy to tweak certain memory settings. I don't run it in the background because I believe that memory recovery features are snake oil and with proper cache settings should not be needed, I've never found a need anyway.

I also have created a "permanent" swapfile and have enabled conservative swapfile use in Cacheman's settings.

I'm running WinME and really can't say how well Cacheman would work in XP.
Locked