Slashdot Mirror


Firefox Memory Leak is a Feature

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."

8 of 602 comments (clear)

  1. Total cached page limit. by Short+Circuit · · Score: 5, Insightful

    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!

    1. Re:Total cached page limit. by Rolan · · Score: 4, Insightful

      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.

      --
      - AMW
  2. So I'll be the first to say it.... by JordanL · · Score: 4, Insightful

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

  3. What I'd like Mozilla devs to do by A+beautiful+mind · · Score: 5, Insightful
    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.
    --
    It takes a man to suffer ignorance and smile
    Be yourself no matter what they say
  4. Huh? by countach · · Score: 4, Insightful

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

  5. Re:releasing memory by Bloater · · Score: 4, Insightful

    > 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?

    Only on a computer without virtual memory. In a PC (which *has* virtual memory), you just punch holes in the memory.

    What happens is a process gets an "address space", into which pointers can point, but any given address may not map onto some real storage. The process asks the operating system to map a range of addresses onto real storage which the operating system will try to map to real fast memory when it thinks it will be used at any moment. When the OS figures the memory wont be needed for a while, and something else needs some memory, the OS copies the data to disk and redirects the mapping to a proxy that will pull the data back into memory when the process tries to use it again.

    When a process knows that it won't need a section of that real storage, it can tell the operating system to unmap it from the address space.

    There are various other things that go on, but that's the simple story. From a figure posted in an earlier message, it seems that opera does pretty damned well (in comparison to most modern programs) with just the simple story, not having to rely much on nasty unreliable heuristics. Of that I am impressed.

  6. Firefox developers don't "get it" by Vellmont · · Score: 5, Insightful

    Memory isn't an unlimited resource you just hoard whenever you think you need it. Right now my instance of firefox is taking up 128 megs! I've seen it up to 256 megs before. This is just simply insane. I've seen people who's computer performance has gone down the tubes because firefox is taking up all the memory (and these are machines with 512 megs of memory, not exactly tiny). What I'd like to convey to the firefox devs is this: Your application isn't the only one running on the system. Play nice and don't be a hog.

    With the number of people complaining about this (and the number of people that don't even KNOW to complain) isn't it a safe bet that you've made a mistake in the amount of cached pages?

    --
    AccountKiller
  7. Re:bfd? by Sigma+7 · · Score: 4, Insightful
    Virtual memory, look into it!


    Virtual memory is not a carte blanche for memory hogging. As you should know, memory hogging will result in degraded performance.

    Assuming that users have unlimited resources is exactly how Mozilla is barely usable on Windows 95-ME - especially when you have Slashdot Moderator access.

    Who cares if Firefox or any app is a bit of a memory hog???

    As long as it is just using the memory as cache space and not accessing the memory randomly, it'll be paged out into virtual memory as needed.


    In an ideal situation, that would be correct.

    However, the operating system does not know which memory is currenly "in use" and which ones are "in cache" - in fact, it's quite easy for an "in use" to be physically sandwiched between two "in cache" entries. Because of this, you will have a sudden loading time if you do plenty of other tasks in the background and suddenly switch back to Mozilla.

    Small applications, being small, do not generally have to wait 1/2 seconds to recover from being pages in or out. Since Mozilla allocates the cache in memory, it will have to wait those two seconds.

    assuming you're using an OS with decent vmem support.


    An OS with decent vmem support would allow you to map files to memory. This results in no swapping at all - only writing perodic output to the hard drive, and loading the file into memory as required. If another application needs more memory, the memory map is discarded with no need to write the contents of memory.

    An application that doesn't exploit the usage of memory maps is as good as an OS with shoddy vmem support. (Of course, it can simply use it's disk cache for the same effect.)