Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Firefox Memory Leak is a Feature

Zonk posted more than 8 years ago | from the that's-what-they-all-say dept.

602

SenseOfHumor writes "The Firefox memory leak is not a bug. It's a feature! The 'feature' is how the pages are cached in a tabbed environment." From the article: "To improve performance when navigating (studies show that 39% of all page navigations are renavigations to pages visited less than 10 pages ago, usually using the back button), Firefox 1.5 implements a Back-Forward cache that retains the rendered document for the last five session history entries for each tab. This is a lot of data. If you have a lot of tabs, Firefox's memory usage can climb dramatically. It's a trade-off. What you get out of it is faster performance as you navigate the web."

cancel ×

602 comments

Sorry! There are no comments related to the filter you selected.

Total cached page limit. (5, Insightful)

Short Circuit (52384) | more than 8 years ago | (#14720067)

So there's a way to limit the number of cached pages per tab, but no way to limit the total number of cached pages, for those of us who have fifteen tabs open?

Whoops!

Re:Total cached page limit. (4, Insightful)

Rolan (20257) | more than 8 years ago | (#14720181)

Yeah, where can I turn off this "feature"? Or, better yet, why doesn't this "feature" release memory when the tab is closed? Either of those would make me much much happier with Firefox.

Re:Total cached page limit. (2, Funny)

Anonymous Crowhead (577505) | more than 8 years ago | (#14720300)

I have a little trick I use from time to time with firefox:

[user@localhost ~]$pkill -9 firefox

I use it once a day at least.

Re:Total cached page limit. (5, Informative)

bpd1069 (57573) | more than 8 years ago | (#14720192)

FTFA: "...For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1."......If you set this preference to another value, e.g. 25, 25 pages will be cached for every tab. You can set it to 0 to disable the feature, but your page load performance will suffer.

Re:Total cached page limit. (2, Insightful)

Short Circuit (52384) | more than 8 years ago | (#14720295)

I wouldn't call completely disabling the feature an optimal solution.

Me, I'd like to limit it to 25 cached pages, and have the old ones shuffled out as new ones are shuffled in.

Re:Total cached page limit. (1, Informative)

Anonymous Coward | more than 8 years ago | (#14720325)

I'd be curious to know if I'm the only person that doesn't have that preference. I've got a browser.sessionhistory.max_entries, but that's it.

Re:Total cached page limit. (1)

abdulla (523920) | more than 8 years ago | (#14720193)

According to someone else that replied on the site, the bfcache is actually global and shared, so it's _not_ per tab. But they could also be wrong. It would seem ridiculous not to share the cache where possible. Often I find myself with multiple tabs open that share pages in history.

Re:Total cached page limit. (5, Informative)

SmartSsa (19152) | more than 8 years ago | (#14720200)

From the Tips & Tricks page:

Specify the memory cache usage

        Normally, Firefox determines the memory cache usage dynamically based on the amount of available memory. To specify a specific amount of memory cache, add the following code to your user.js file: // Specify the amount of memory cache: // -1 = determine dynamically (default), 0 = none, n = memory capacity in kilobytes
        user_pref("browser.cache.memory.capacity", 4096);

        To disable the memory cache completely, add the following code: // Disable memory cache:
        user_pref("browser.cache.memory.enable", false);

Re:Total cached page limit. (1)

mnmn (145599) | more than 8 years ago | (#14720365)

Or even better limit the amount of memory FF uses. We can place a hard limit (100mb) and even have FF malloc the entire amount from the getgo for speed. It then uses the memory with no collisions or fragmentation while other heavy processes are running, and the other processes wont take a hit when you have 15 tabs open... especially on production solaris and rs6000 machines. (i know i know bad idea).

How nice. (1)

Pig Hogger (10379) | more than 8 years ago | (#14720100)

How nice!

Now, how about telling us so up-front? And how about disabling it, or having another "feature" that enables us to turn it off?

Re:How nice. (1)

wizbit (122290) | more than 8 years ago | (#14720153)

RTFA - you can change the setting via a user preference:

For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. [...] You can set it to 0 to disable the feature, but your page load performance will suffer.

Wow. If this excuse had come from MS... (0)

Anonymous Coward | more than 8 years ago | (#14720101)

... it would be The Satanic Verses all over again. The developer would have to spend the next four years cowering in Bono's basement.

Dumbest thing I've ever heard. Why is all this memory being used per tab?!

Re:Wow. If this excuse had come from MS... (0, Insightful)

Anonymous Coward | more than 8 years ago | (#14720554)

Uhuh. It's the same with Google.

One minute we're all pro-civil liberties, pro-free speech, anti-censorship, anti-repression but the moment Google wants to do business in China, 'they're only following the laws of that country', they're doing nothing wrong. Switch with Microsoft and they'd be 'dealing with an evil regime, shame on them' yadda yadda.

Same with Nintendo. Bash Microsoft and Sony for coming out with unoriginal sequels yet Nintendo are such innovators for bringing out Metroid Fusion, Super Smash Brothers Melee and Super Mario Rainbow Warrior.

What a small world (5, Funny)

Rude Turnip (49495) | more than 8 years ago | (#14720108)

Did the Mozilla Foundation hire the same PR firm that Microsoft uses?

Re:What a small world (0)

Anonymous Coward | more than 8 years ago | (#14720431)

Did the Mozilla Foundation hire the same PR firm that Microsoft uses?


Exactly my first thought too. Ah, the irony :D

Christ is it a waste (1, Interesting)

heinousjay (683506) | more than 8 years ago | (#14720112)

I left Firefox running overnight by accident, and when I woke up, the working set was over 2 gigs. I think that might be a touch excessive.

I still like it as a browser, though.

My boss doesn't agree.. (4, Funny)

lbrandy (923907) | more than 8 years ago | (#14720113)

My bos doesn't agree at all. I tried including this feature in several of my builds. My company is so regressive, we have alot to learn from the leaders like Firefox.

My pet peeve! (1, Interesting)

RingDev (879105) | more than 8 years ago | (#14720116)

"(studies show that 39% of all page navigations are renavigations to pages visited less than 10 pages ago, usually using the back button)"

So why is it that when I open a new tab I have to manually cut/paste the same address in it. For example, replying to an article on /., If I want to quote the summary, I need to hit the back button to copy the text I want, then forward again to paste and type. Why can't I hit ctrl-T and get a new tab with the same page I'm currently on, then hit reply and anything I want to quote I can just switch tabs instead of screwing around with back/forward and scrolling.

-Rick

Re:My pet peeve! (1)

JordanL (886154) | more than 8 years ago | (#14720178)

You can!!! Just use Opera! (It's the Down->Up Mouse-gensture... produces a tab witht he same history as the one you are currently viewing)

Re:My pet peeve! (2, Informative)

nxtw (866177) | more than 8 years ago | (#14720183)

It's not the most ideal solution, but I can drag and drop the favicon (the icon in between the Home button and address in the address bar, with default toolbar settings) to my tabbar to effectively get a duplicate of the current page. (Tab Mix Plus might be the cause of this feature). I don't have a Firefox that isn't loaded with Tab Mix Plus around, but I don't think you need the extension to do this.

Tab Mix Plus also has an option to always open the current page in a new tab.

Re:My pet peeve! (2, Informative)

emmetropia (527623) | more than 8 years ago | (#14720651)

For the sake of knowledge, you *don't* need the extension.

Re:My pet peeve! (2, Informative)

Rude Turnip (49495) | more than 8 years ago | (#14720188)

"Why can't I hit ctrl-T and get a new tab with the same page I'm currently on, then hit reply and anything I want to quote I can just switch tabs instead of screwing around with back/forward and scrolling."

I just replied to your post using Firefox. I middle clicked on "Reply to This," which brought up your post appearing by itself in its own tab. I just copied and pasted some of your post into my reply, hit "Submit" and went on my merry way. Isn't that simple enough? Although I would like to see a /. equivalent of the Farkit extension.

Re:My pet peeve! (2, Informative)

TERdON (862570) | more than 8 years ago | (#14720191)

At least in the OS X version, commandclicking (and probably middleclicking as well, but I haven't got a mouse connected) the back button solves this problem nicely. I would guess that middleclicking the back button works under other operating systems as well. So just click "reply" first, then middleclick the back button. :)

Re:My pet peeve! (3, Informative)

HTH NE1 (675604) | more than 8 years ago | (#14720411)

I regularly use middle-click to open a link in a new tab in the first place. However, the Mac OS X version of Mozilla lacks this option, expecting me to configure my mouse to do a command-click on middle-click instead to get the same functionality I enjoy on Linux.

Usually the only time I use a browser under Windows is for Windows Update.

And just testing right now, middle-clicking on the Back button does nothing for me under Linux. It has a visual reaction but otherwise does nothing else. Maybe it is another one of those Firefox features not found in Mozilla?

Re:My pet peeve! (2, Interesting)

pete6677 (681676) | more than 8 years ago | (#14720197)

That would be a nice user-configurable option. As it is, I don't find it too much trouble to hit shift-tab a couple of times, ctrl-C, ctrl-T, ctrl-V, enter to get the same page in a new tab, but it would save a few steps to have this choice. But I definitely wouldn't want new tabs opening up with the current page and no option to turn this feature off.

Re:My pet peeve! (0)

Anonymous Coward | more than 8 years ago | (#14720265)

Use a 3 button mouse when you can. The middle button opens up a link in a new tab.

Re:My pet peeve! (5, Informative)

Alystair (617164) | more than 8 years ago | (#14720267)

I found that pressing Ctrl+Z after Ctrl+T brings up the URL from the last tab you were on. Now you just need to press Enter.

Re:My pet peeve! (1)

BeesTea (580793) | more than 8 years ago | (#14720781)

Thanks for that info.

Re:My pet peeve! (2, Informative)

SaturdayNight (540943) | more than 8 years ago | (#14720270)

This extension [garyr.net] , tab mix plus, has that functionality and a lot more built in (Duplicate Tab). Not sure if you can make it a keyboard shortcut though. Very handy tool for me.

Re:My pet peeve! (1)

FSWKU (551325) | more than 8 years ago | (#14720279)

Mouse Gestures 1.0.4

There's an entry in the mappings for "Duplicate Tab." Mine is currently set to down-up-down, but you can change it to whatever is most convenient for you.

Re:My pet peeve! (1)

JordanL (886154) | more than 8 years ago | (#14720323)

So lets see.... FireFox duplicates Opera features, then IE duplicates FireFox features...

Whoa! I must be using IE version 9 right now!

Re:My pet peeve! (1)

IthnkImParanoid (410494) | more than 8 years ago | (#14720290)

All In One Gestures (and other mouse gesture extensions) allow you to "duplicate tab," which opens a new tab with the same URL (and post data?) as the current one.

I'm not sure if there's a way to do it through a single keyboard shortcut, but ctrl-L (go to location bar), ctrl-C, ctrl-T, ctrl-V is a workaround.

Re:My pet peeve! (1)

smitke (195883) | more than 8 years ago | (#14720304)

Middle click the "Back" button.

Mod this guy up (1)

SydShamino (547793) | more than 8 years ago | (#14720363)

Damn that's sweet. I had no idea.

Re:My pet peeve! (1)

vertinox (846076) | more than 8 years ago | (#14720426)

Wow. I had no idea either. Kind of cool.

Re:My pet peeve! (1)

rbarreira (836272) | more than 8 years ago | (#14720703)

Yep. The middle/scroll wheel button works everywhere in firefox and always opens a new tab with the page. Try for example the "View Image" option in the right-button menu on top of an image - it loads the image in a new tab.

Lots of good info, mods! (1)

RingDev (879105) | more than 8 years ago | (#14720492)

Lots of great replies to me pet peeve, I hope some mods dish some points out to these posters!

-Rick

Re:Lots of good info, mods! (0)

Anonymous Coward | more than 8 years ago | (#14720819)

Hmm. My pet peeve is assholes who put their signature in every post, rather than the SIGNATURE AREA!!!!! Are you illiterate, clueless, or just so self-important that you have to make sure we all see your signature, even if we don't want to?

Clone Window (2, Informative)

rakslice (90330) | more than 8 years ago | (#14720751)

The Clone Window extension.

Look it up, dingus. There's no reason that every web browser should behave exactly like IE out of the box. That's what the extension feature is for. =)

spyware with IE or memory leak with FF.. (2, Insightful)

madnuke (948229) | more than 8 years ago | (#14720125)

Hard choice but I'm seriously looking at Opera after seeing this I have a gig of RAM and its still laggy, I was wondering why the 'leak' was so high theres no way you could put that much bad programing to make a programe eat memory like a fat kid in a pie shop.

Re:spyware with IE or memory leak with FF.. (0, Flamebait)

ashot (599110) | more than 8 years ago | (#14720268)

there are many many other reasons to switch to Opera as well.

Re:spyware with IE or memory leak with FF.. (1)

SimplePaul (807846) | more than 8 years ago | (#14720658)

Go for it. You won't look back.

Opera's memory usage is excellent - especially when dealing with images.

The tab management is a lot more advanced than FF too, imo.

If FF is lagging on you... and IE is not secure... why are you not using Opera yet??

Re:spyware with IE or memory leak with FF.. (1)

Ruprecht the Monkeyb (680597) | more than 8 years ago | (#14720763)

Opera (or at least recent builds) does the same thing regarding caching. I have a dozen or so tabs open now and Opera 9b2 is using 90MB of RAM and 125 of virtual memory.

In other news... (5, Funny)

GillBates0 (664202) | more than 8 years ago | (#14720142)

...scientists have determined that the human appendix is not an evolutionary anomaly as previously thought, but an intelligent design feature aimed at keeping the humans guessing as to it's actual function.

And in totally unrelated news, the Mozilla foundation recently announced that their flagship browser Firefox shall soon be renamed to Bigfoot, to reflect the software's large memory footprint.

More breaking news on these topics at 11.

Re:In other news... (0)

Anonymous Coward | more than 8 years ago | (#14720395)

FUNNY! Very funny. But you must remember never to troll the Slashdot favorites. Remember also that Slashdot is a community of FANBOYS.

Ready... Aim... (-1, Flamebait)

Spy der Mann (805235) | more than 8 years ago | (#14720143)

*ahem* Mind telling us who was the programmer who had this "brilliant" idea?

I promise, I won't do ANYTHING bad to him *whistles innocently* really! *Loads gun behind his back* :P

Just for the record... (1)

Spy der Mann (805235) | more than 8 years ago | (#14720174)

yes, it was a joke.

Re:Ready... Aim... (0)

Anonymous Coward | more than 8 years ago | (#14720252)

The humor in all of this is, you don't really have a gun and you would never really shoot someone, as your post suggests you are man enough to do. Grow up.

Doesn't seem to be true (3, Insightful)

amliebsch (724858) | more than 8 years ago | (#14720147)

If this is true, then why is so little memory freed after the tab is closed, compared with how much it consumed when it was created?

Re:Doesn't seem to be true (1)

7macaw (933316) | more than 8 years ago | (#14720216)

Yeah, and even though I don't use tabs (such a pervert I am), but have, like, 10 windows open instead, firefox still tends to eat all of the system's memory, so I have to restart ff from time to time. So annoying.

Re:Doesn't seem to be true (1)

ummit (248909) | more than 8 years ago | (#14720378)

Because programs rarely return memory to the OS when they free it internally. See here [c-faq.com] . Try changing the pref (as described elsewhere in this thread), restarting Firefox, and watching its memory usage then.

releasing memory (5, Interesting)

DreadSpoon (653424) | more than 8 years ago | (#14720433)

The answer to that is pretty simple:

The heap, where dynamic allocations occur, is only allowed to grow or to be truncated. An application cannot release memory in the middle of the heap without also releasing the memory at the end of the heap.

So let's say Firefox makes 10 one-page allocations, and frees the first 9. The memory layout might look something like:
XXXXXXXXXU (X- unused, U- used)

Those 9 pages worth of memory aren't being used, but it's impossible to release them back to the OS.

Thankfully, there is some good news: when Firefox needs to allocate more memory, it can and will just reuse those 9 unused pages instead of allocating more memory from the OS and growing the heap.

The best solution to this problem is to use a compacting garbage collector. Which is something that Java and C# and other higher-level langauges can easily make use of (and many do use them), but which C and C++ can't really make use of given the complete lack of compiler support. That's one reason why a Java or C# app can actually out-perform a similar C/C++ app, especially with a good native-code compiler and an library implementation with a modern GC.

Re:releasing memory (1)

N7DR (536428) | more than 8 years ago | (#14720637)

but which C and C++ can't really make use of given the complete lack of compiler support.

I wouldn't know about C, but this statement is utterly false as applied to C++. Replacing the default new and delete routines is perhaps not for the inexperienced C++ programmer, but to say that there's an complete lack of compiler support is simply wrong. It is true that out-of-the-box C++ does not have a compacting garbage collecter, but one can certainly be written (and used, of course) with any conformant compiler.

Re:releasing memory (1)

cortana (588495) | more than 8 years ago | (#14720666)

Wouldn't all pointer references then have to go through some kind of lookup table, so that the objects could be relocated by the runtime without breaking them?

Re:releasing memory (1)

syukton (256348) | more than 8 years ago | (#14720661)

What is the technical feasibility of a button that is labeled "shrink heap" which would move all used memory to the beginning of the heap and truncate the heap, thereby freeing the unused memory?

ie: XXXXXXXXXU becomes UXXXXXXXXX and then the (XXXXXXXXX) block is dropped, leaving the amount of consumed memory at one page (U)?

What is the ease of implementation of such a feature? Could you ballpark it on a difficulty scale of 1 (least) to 10 (most)?

Re:releasing memory (2, Insightful)

Anonymous Coward | more than 8 years ago | (#14720694)

An application cannot release memory in the middle of the heap without also releasing the memory at the end of the heap.

That's not strictly true. If the hole is larger than 4k (or 8 if it's not page-aligned), there are two things that can be done.

You can decommit the page, but keep it reserved. This frees RAM, decreasing the process's memory usage, but still takes up some of its address space. You MUST coalesce free heap blocks in this case, because all data in those pages is lost. This also requires extra housekeeping.

Or you can keep it committed, and the OS will push that memory out to the page file. This is done pretty much automatically, but it's more lazy. In Windows, you can somewhat force this by minimizing all windows owned by the process.

The best solution to this problem is to use a compacting garbage collector.

Unless you've done actual research, I wouldn't be so quick to say that. It's certainly the easiest solution if you're using a language that doesn't use real pointers, but there are numerous possible solutions.

Eg, you could allocate pages for large objects like this directly from the OS rather than using a heap. Then freeing objects in the middle is no problem at all.

Re:releasing memory (2, Interesting)

mrsbrisby (60242) | more than 8 years ago | (#14720846)

You can decommit the page, but keep it reserved. This frees RAM, decreasing the process's memory usage, but still takes up some of its address space. You MUST coalesce free heap blocks in this case, because all data in those pages is lost. This also requires extra housekeeping.

mmap() can do this, but on many systems [s]brk() cannot. brk() is also alot faster than mmap().

This is really moot on most systems; don't do a lot of little allocations that you're going to keep around for a while and DO use pooled allocators that can use mmap(). It requires planning, but it really does pay off for applications that need an awful lot of memory in stages.

This is (by the way), why many C compilers are implemented in "stages", so that they don't have to worry about crap like this. Allocate as needed, and the next stage exec() will automatically compact and garbage collect any pages used in the previous stage that aren't needed here (that weren't passed to the next process using mmap or pipes).

Re:releasing memory (1)

stefanlasiewski (63134) | more than 8 years ago | (#14720738)

it can and will just reuse those 9 unused pages instead of allocating more memory from the OS and growing the heap.

But then the heap is still huge, right? Firefox will reuse those 9 unused pages, but if each page takes 1MB in the heap, Firefox still has 132MB sitting there in the heap, unused.

I have one page which triggers the memory leak-- It's a system monitoring page, which refreshes every minute. This page is critical to my job, and I would keep this page open forever if I could. However after 24 hours Firefox will grow to be over 150MB in size.

Combine this with high memory usage in Outlook and the Antivirus/firewall suite, and we're talking 350MB. Ouch!

about:config (2, Insightful)

whysanity (231556) | more than 8 years ago | (#14720155)

how about a configurable option to not take up 200mb of ram? keep it as-is by default, but let power users toggle it off

So I'll be the first to say it.... (4, Insightful)

JordanL (886154) | more than 8 years ago | (#14720156)

Why does Opera do the same thing faster without the memory penalties?

Re:So I'll be the first to say it.... (1)

ashot (599110) | more than 8 years ago | (#14720220)

amen to that, much faster.

Re:So I'll be the first to say it.... (0)

Anonymous Coward | more than 8 years ago | (#14720586)

Seriously, I was thinking the same thing. I've gotten so used to hitting Back in Opera and seeing the form I just filled out (with my input), or whatever I was looking at just appear instantly. I go to hit Back on IE and get irritated that the 'page has expired'. I don't want a new page, I want to see exactly what I just saw again, that's why I hit Back.

Furthermore, I just saved the largest page I can think of, a timesheet application with 240 form fields, and loads of javascript running 7 dropdown menus. That page is a total of 260k in size. There's simply no excuse for Mozilla saying the memory leak is the result of caching 100s of MB of pages, at 260k absolute max, that's over 360 pages in 100 MB, if only 10-20 pages are being cached per tab, and you have 20 tabs open, that's 200-400 pages, and I wager that many of them are under 50k.

So the question remains, why can Opera do this so elegantly, including saving the status when the program is reopened? Or, I guess a better question is, why can't Firefox do it? Are they really that far behind Opera?

Re:So I'll be the first to say it.... (3, Interesting)

JordanL (886154) | more than 8 years ago | (#14720674)

I suspect that some of it may be due to talent. Perhaps Opera programmers are just more talented on average than the typical FF dev. As well, I also suspect that its simple goal orientation. The Opera company works on building a new browser that's better with new features. The MozDevs collaborate on whose got which tickets and how they'll be integrated into the source and such.

This is proof positive, I think, that OSS != the best option in all scenarios. Opera consistently beats FF out on features, security, and speed... and it does it without having to download "extensions".

Re:So I'll be the first to say it.... (1)

stu42j (304634) | more than 8 years ago | (#14720777)

It is not saving the html, it is saving the rendered DOM which is probably larger. You also have to include images and any other external objects.

Quick Fix (3, Informative)

I_am_Rambi (536614) | more than 8 years ago | (#14720159)

about:config [about] then search for browser.sessionhistory.max_total_viewers and set it to 0. This will be 0 pages in the cache per tab. You will get a reload slow down since FF will be going out to the web. You can manually set this to 2 or whatever you want. By default FF will cache upto 8 pages per tab with 1 gig of memory or more.

Re:Quick Fix (0)

Anonymous Coward | more than 8 years ago | (#14720414)

Why is this set to -1 in my browser 1.5.01? What will setting the integer to 2 really do?

Re:Quick Fix (0)

Anonymous Coward | more than 8 years ago | (#14720630)

OMFGHAX0RZ!!!!11!11!1one!11!

At least it can be changed... (1, Redundant)

The-Bus (138060) | more than 8 years ago | (#14720171)

From TFA:

For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. No more than 8 pages per tab are ever cached in this fashion, by default. If you set this preference to another value, e.g. 25, 25 pages will be cached for every tab. You can set it to 0 to disable the feature, but your page load performance will suffer.


For those that don't know or remember, the preference is accessed by typing about:config in Firefox's address bar. Let's see if there's still a leak after you change the option. I know when I close tabs the memory usage doesn't go down.

Re:At least it can be changed... (1)

martinultima (832468) | more than 8 years ago | (#14720257)

So the way I see it is this – you turn it off, page performance suffers because of lack of cache. You turn it on, page performance suffers because of lack of memory. Ah, choices...

Well, I guess I may as well find a different browser since I obviously can't fit Firefox, KDE, Enlightenment, OpenOffice.org, The GIMP, and not to mention every game on my system into my laptop's 96MB of RAM :-) Nah, just kidding.

Seriously though, a lot of the time if I don't need JavaScript or CSS, I'll just pull up Dillo [dillo.org] . So much faster... and Konqueror kicks ass too, especially with the embedded file manager / SSH file transfer client / embedded terminal emulator...

Write to a file (1)

hpygocrazy (152329) | more than 8 years ago | (#14720180)

Too bad they don't write that cached pages to a file isn't of retaining them in memory. The load time would be slower than being read from memory but faster than reloading from the web site.

Somebody call Redmond (1, Troll)

dedazo (737510) | more than 8 years ago | (#14720196)

Someone needs to remind the IE team that this is not - I repeat not - one of the Firefox features they have to copy.

And this better be easily disabled. As in a checkbox in a dialog, not having to hack about:config. I don't pay $$$ per month for broadband just to have the browser playfully load teh interwebs into my RAM so I can "perceive" more speed.

It's ridiculous that Firefox uses 700MB of memory with 4 tabs open (right now, btw). They need to fix this, not engage in creative PR.

Re:Somebody call Redmond (1)

openldev (925511) | more than 8 years ago | (#14720229)

What are you talking about? I have 7 tabs open right now & am using only 47MB of memory ...

Re:Somebody call Redmond (1)

dedazo (737510) | more than 8 years ago | (#14720334)

What are you talking about?

Your options are:

  1. I'm making this up because I have nothing better to do.
  2. Firefox does not release memory when closing tabs, and in fact leaks memory throughout a session until it usually crashes.
  3. You're lucky.

Pick any one, as long as it's #2.

Re:Somebody call Redmond (1)

FhnuZoag (875558) | more than 8 years ago | (#14720772)

I'm picking number 3. In most of my Firefox installs, I don't experience a memory leak problem. Perhaps a platform specific problem?

So... (1)

Trogre (513942) | more than 8 years ago | (#14720199)

Where is the prefs.js option that lets me turn this feature OFF ???

Re:So... (1)

Trogre (513942) | more than 8 years ago | (#14720289)

Well would you look at that. After R'ing TFA I found the option right there taking up half the article:


For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. When set to this value, Firefox calculates the amount of memory in the system, according to this breakdown:
RAM Number of Cached Pages
32MB 0
64MB 1
128MB 2
256MB 3
512MB 5
1GB 8
2GB 8
4GB 8

(reference: nsSHistory.cpp)

No more than 8 pages per tab are ever cached in this fashion, by default. If you set this preference to another value, e.g. 25, 25 pages will be cached for every tab. You can set it to 0 to disable the feature, but your page load performance will suffer.


I'm still not fully convinced though - I can have a dozen windows open with 20 tabs each and after a few days that takes up a lot of memory as expected. However you would expect that memory to be released when you close most of the windows/tabs. Not the case. You have to actually exit the entire program before any memory will be freed. And it's not just 'ps' reporting shared libraries since the entire system performance suffers noticeably.

I wonder if the CloseTab() function forgets to clear the history buffers for that tab? Maybe it's time to investigate talloc().

I'm all for features, but... (1)

adminsr (919472) | more than 8 years ago | (#14720202)

I sure wish this was an optional *feature*.

NOT per tab (5, Informative)

savala (874118) | more than 8 years ago | (#14720212)

Ben was mistaken, it's cached globally.

See this comment [mozillazine.org] by Boriz Zbarsky:

Ben, those numbers are NOT per tab. The bfcache is global; there are never more than 8 pages total in bfcache (and you need to have 1GB of RAM for this to happen). Most users have 3 or 5 pages in bfcache at any given time.

and this comment [mozillazine.org] by David Baron:

The point of bug 292965 was that the pref should be global, not per-tab. Is that not working correctly?

(Boris and David are back-end developers; they have much more working knowledge of this than Ben does.)

Also, there are actual memory leaks in Firefox. See this weblog post [squarefree.com] about progress on that. However, as that weblog post says as well, most excessive memory usage that people are seeing is entirely due to faulty extensions.

Why doesn't closing tabs free memory? (1)

cibyr (898667) | more than 8 years ago | (#14720226)

Ok, great, so having lots of tabs open uses lots of memory to cache all those pages and some history... but why doesn't that memory get freed when those tabs get closed? Just now I had about 16 tabs open and FF was using 58MB (up from about 40 before opening some of them). I closed half those tabs and the VM size is 54MB.

A limitation of the C library (1)

tepples (727027) | more than 8 years ago | (#14720482)

but why doesn't that memory get freed when those tabs get closed?

In most implementations of the C library, malloc() is implemented in terms of sbrk(), which adds memory to a program's heap but never releases it until the program closes.

What I'd like Mozilla devs to do (5, Insightful)

A beautiful mind (821714) | more than 8 years ago | (#14720287)

Let them release 2.0, but then try to focus on:
  • fixing the practically fixable bugs (not the design decisions)
  • making code performance improvements (faster, with less memory!)
  • security auditing
...for a half year or a year. I don't need new features, I'm currently happy with the ones I have and I'd prefer the current features working securely, in a speedy fashion and mostly without bugs. This time period would also give enough time for extensions to mature more.

Before someone jumps at my throat, it's just a description what I'd like to see, but of course its all up to the developers, they decide what to code and do with their time. It is just simple user feedback.

Re:What I'd like Mozilla devs to do (0, Flamebait)

Anonymous Coward | more than 8 years ago | (#14720436)

This is just Mozilla getting back to doing what Mozilla does best, making crappy software. For years with every Mozilla browser release we were promised a fix to all the bugs and each time they either failed to deliver or they fixed some existing bugs but created new ones. This is why they started fresh with Firefox instead of wasting time trying to fix the bazillion bugs they had in Mozilla. For a while it seemed like they were actually on the right path with Firefox, but now it seems like they've reverted back to the Mozilla of old.

It's not all bad though, there's always Opera and IE7.

Firefox is the most unstable program in common use (5, Informative)

Futurepower(R) (558542) | more than 8 years ago | (#14720331)

See Firefox is the most unstable program in common use [slashdot.org] .

The Firefox CPU hogging bug makes a computer unusable until all Firefox windows and tabs are closed. Basically, Firefox uses first maybe 10%, then maybe 20% of the CPU, and, as Firefox windows and tabs are opened and closed, continues taking more of the CPU time until Firefox is closed. This CPU usage is with NO Firefox activity, or any activity of any program.

This bug is more than 3 years old. It is extremely difficult to characterize; no one has succeeded yet. Here are some clues:

Somehow Thunderbird and Mozilla share this bug. Sometimes when Firefox is taking say, 94% of the CPU, and Firefox is closed completely, Thunderbird or Mozilla will begin using a lot of CPU time. Very weird, but it often happens.

Firefox 1.5.0.1 is much worse than 1.5, which is worse than earlier versions. This suggests that there is some resource in Firefox that is being more overused as features are added.

The CPU hogging bug continues unchanged when Firefox 1.5.0.1 is installed with a clean profile and no extensions.

Too many mouse clicks too closely spaced will often increase Firefox's CPU usage, or sometimes cause it to crash.

--
Before, Saddam got Iraq oil profits & paid part to kill Iraqis. Now a few Americans share Iraq oil profits, & U.S. citizens pay to kill Iraqis. Improvement?

Why does Opera work well, and not Firefox? (4, Informative)

Futurepower(R) (558542) | more than 8 years ago | (#14720698)

More clues:

  • Opera has none of these problems. So, the quote from the Mozillazine blog shown below, although it is typical, is not supported by the facts.

  • Whatever causes the CPU hogging bug is definitely associated with extreme memory use. No doubt there are leaks, but this is not a leak, since it is not necessarily associated with greater use of Firefox.

  • Users often report that just leaving Firefox open overnight causes CPU hogging and extreme memory use.

  • The problems are the same in Mozilla browser.

  • It's good to test Firefox with a laptop in a quiet environment. When you hear the laptop fan begin to run while there is no activity, you know Firefox has begun to suck CPU cycles.

  • Putting a computer into standby or hibernation often makes the CPU hogging bug much worse. That's why Firefox users sometimes just leave their computers on.

  • When a computer takes a long, long time to start from standby, you know Firefox is taking CPU cycles. What about coming out of standby makes Firefox unstable? No other program has that problem.

Quote from the blog linked in this Slashdot story About the Firefox "memory leak" [mozillazine.org] : "A lot of people complain about the Firefox "memory leak(s)". All versions of Firefox no doubt leak memory - it is a common problem with software this complicated."

No other program in common use is so buggy. The problems in Firefox are not "common".

Another quote from the linked Mozillazine blog: "What I think many people are talking about however with Firefox 1.5 is not really a memory leak at all. It is in fact a feature."

That's not what the technical magazines [cmp.com] , newsletters [scotsnewsletter.com] , web sites entirely devoted to Firefox problems [slyerfox.com] , and even the mainstream media say. They say it is a serious problem.

Mozilla developers have been denying that there is a serious problem for more than 3 years. It seems that it would be less work to fix the problem than to undertake a cottage industry of trying to convince people they aren't having problems. Mozilla developers have been impeding characterization by marking Bugzilla bug reports of these problems invalid.

However, it is clear that it would take a serious scientific investigation; this is not an easy bug to characterize.

Re:Firefox is the most unstable program in common (0)

Anonymous Coward | more than 8 years ago | (#14720711)

Why keep people on slashdot spreading this kind of FUD? The accounts are at best anecdotical, People here are using Firefox 1.5.0.1 on Windows XP & SUSE 10 on about 100 computers and it works just fine.

sounds good to me (1)

ummit (248909) | more than 8 years ago | (#14720355)

Why is everyone bitching about this? I hate waiting for any refetch or rerendering when I use the Back button; I want it to be instantaneous. That page was fetched and rendered aslready, so having the browser keep it around for when I go back to it is exactly what I'd want it to do.

Re:sounds good to me (0)

Anonymous Coward | more than 8 years ago | (#14720505)

Of course you love it, fanboy. If it wasn't open source, you'd be trying to make it rain.

Beat it.

Re:sounds good to me (1)

ummit (248909) | more than 8 years ago | (#14720745)

Sure, but fan of what? I'm using Safari under OSX at the moment...

> Beat it.

Spoken like a true AC. :-)

seems snappier (2, Informative)

miyako (632510) | more than 8 years ago | (#14720374)

firefox's memory usage has always been a thorn in my side. I tend to average around 20 to 25 tabs open, usually while I'm running other ram hungry applications. Firefox generally was eating up about 200-250 megs of ram on my machine (and I've seen it go as high as 600 megs). After changing the browser.sessionhistory.max_total_viewers to 0 and running "top" firefox seems to be using about 46 megs of ram right now. It also doesn't feel particularly slower than it did before. I have a feeling that the benefit of caching so much was actually having a negative return after a certain point because the machine was so starved for ram.
On a side note, if anyone is like me and looks in about:config for browser.sessionhistory.max_total_viewers and doesn't see it, you have to actually add the line. Right click and choose "new" then type in "browser.sessionhistory.max_total_viewers" and then 0 (or whatever you like).

Simple solution (1)

vertinox (846076) | more than 8 years ago | (#14720389)

Buy more RAM!

Seriously, I think 1024MB of ram doesn't cut it these days. Maybe we should just accept 4gb of ram will be the norm in 2007-2008. I seriously could use it with other memory hungry apps that are sluggish *coughs* Illustrator *coughs* Indesign *coughs*.

Re:Simple solution (0)

Anonymous Coward | more than 8 years ago | (#14720682)

Right...

"I need 4gb of RAM please."
"What for, are you a graphic artist?"
"No, I want to surf the web."

uh huh.

I have another, even simpler solution, that doesn't require you to pay anything:

Opera [opera.com]

Re:Simple solution, make the RAM 640k (1)

WillAffleckUW (858324) | more than 8 years ago | (#14720761)

Seriously, I think 1024MB of ram doesn't cut it these days. Maybe we should just accept 4gb of ram will be the norm in 2007-2008. I seriously could use it with other memory hungry apps that are sluggish *coughs* Illustrator *coughs* Indesign *coughs*.

I personally think that noone will ever need more than 640gb of RAM. So let's hard code that in, shall we?

Huh? (4, Insightful)

countach (534280) | more than 8 years ago | (#14720459)

Uh, using a lot of memory is not the same as a memory leak.

Don't bug me (5, Interesting)

joeytsai (49613) | more than 8 years ago | (#14720478)

I think this submission is confusing two points. First of all, is this really a memory leak? A program that uses a lot of memory is not necessarily a leaking program. A memory leak is a programmatic error where memory is allocated but never freed, even when there's no way to use that object again. As the program continues to allocate memory, the heap size of the process increases until eventually the OS terminates the process (eg., the OOMKiller). Actually, many applications you normally use leak memory - but as long as they don't waste a ridiculous amount of memory most people don't care, especially since most process lifetimes are relatively short (compared to a daemon process like apache), and after termination the OS reclaims all the program's memory, leaked or not.

What is being described here sounds much more like a cache of recent pages, which in my opinion is perfectly sane for a browser. Sure, maybe the cache is a bit overzealous, but even if that's the case, just disable it - worse case scenario, you edit the source. But otherwise, this is definitely a feature - I can promise you it's much more programming effort to save old pages for a quick redraw than to free the old page and replace it with the new.

So I guess the discussion here is, "is it right for firefox to use so much memory?" My answer is yes. It is not a memory leak, it seems like a very valid design decision. But if you disagree, old versions of firefox still work great (I still haven't upgraded myself).

Amazing! (1)

Elladan (17598) | more than 8 years ago | (#14720507)

Of course, my copy of firefox will leak about 10 megabytes a second if I just go to a page with hundreds of jpegs on it
and hit shift-reload over and over again.

I wonder if that's a feature too?

(Even better, it doesn't leak Firefox process memory, but rather X11 pixmaps)

so what? (1)

ShaneThePain (929627) | more than 8 years ago | (#14720562)

I already have a task bar at the bottom of my screen. I just open a seperate window. Who needs tabbed browsing? Its just more screen real-estate wasted on another useless bar. Use the windows task bar! OPEN A SEPERATE WINDOW!

Re:so what? (1)

rbarreira (836272) | more than 8 years ago | (#14720787)

Yeah, because everyone likes having 1-pixel-wide window miniatures on their task bar. And don't talk me about the "group similar windows" feature (which btw only appeared on Windows XP), that sucks for a lot of programs (such as MSN Messenger for example). Unless you have a way to enable that option just for Firefox - and even then, it would only work on Windows XP, not 2000 (which a lot of people use).

What if you have source code and change it? (1)

WillAffleckUW (858324) | more than 8 years ago | (#14720582)

Is it still a feature then?

Or is it - instead - a personally-resolved memory cache integrity issue that you submitted to the code base?

Huh?

Close all tabs, still tons of RAM consumed (1)

shodson (179450) | more than 8 years ago | (#14720654)

I'm not buying this. Even if I close all of my tabs after several hours of use firefox.exe can still be taking up to 100MB of my RAM. The only way to completely reclaim the memory is to completely shut down firefox.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>