Browsers look like people - they become old, they swell, and they fall into a younger and slimmer model.
Firefox is not just a browser, it is an ecosystem. Although I think the latest versions are pretty bloated, the main product is generally stable.
However, firefox is an ecosystem / platform for:
1) Poorly written plugins
2) Poorly written JavaScript code that runs inside it.
3) Adobe flash as a platform for heavy video and for poorly written advertising scenarios, such as "hit Osama bin Laden with duck to reduce mortgage rates and get a free iPod * (participation required).
4) Quicktime and another media player.
5) Some built-in Java codes.
The memory leak description suggests that the script is running amok or a third-party tool requesting more memory. If you've ever run Flash on a Mac, it's almost the same as 90% of the processor load.
The goal of most programming languages ββis not to save you, but to provide you with tools for salvation. You can write bad and bloated code with memory leaks in any language, including garbage collection. Third-party tools are usually not as well tested as the platform itself. Web pages that try to do too much are also not uncommon.
If you want to do an experiment to demonstrate this, get a mac from Firefox and go to a well-written site like Stack Overflow, and spend an hour. Memory usage should not increase much. Then spend 5 minutes on random pages on Myspace.
Now let me try to answer your questions based on my guesses, as I am not familiar with the source code
- When I close all tabs, why doesn't memory use the way down?
While each browser instance is an independent process with its own memory, tabs in one window are in the same process. Some kind of in-memory caching was used in Firefox, and just closing the tab does not immediately remove the corresponding information from the in-memory cache. If you re-open a tab on the same site, you may get better performance. There was some advanced option allowing you to disable it, something like browser.cache.memory.enable. Or just do a search to disable the memory cache.
* Why is there no limits on extensions/themes/plugins memory usage?
For the same reason that Windows or Linux does not have a process for checking applications that you can run on them. This is an open environment and you take the risk. If you need an environment in which apps and extensions are βtestedβ, Apple might be the way to go :)
* Why does the memory usage increase if it left open for long periods of time?
Not all calculations and actions in a script have visual manifestations. A script can do some things in the background (for example, request additional materials, preload things, just errors), even if you don't see them.
* Why are memory leaks so difficult to find and fix?
This is about accounting. Think about every item you've ever held (even a pen), or that someone has borrowed from you in your entire life. Are they all accounted for? Memory leaks are the same (you are taking up memory from the system), except that you are transferring objects around. Then look at the things on your desk, you left something lying because βyou may need it soonβ, although you probably won't? the same story.