Memory Usage of Chrome, Firefox 3.5, et al.
An anonymous reader writes "This experiment graphs the memory usage of Chrome and Firefox 3.5 (along with Safari and Opera) over a series of 150 Web page loads using an automated script. Firefox 3.5 shows the lowest memory usage in all categories, including average memory usage, maximum memory usage, and final memory usage. Chrome uses over 1 GB of memory due to its process architecture. Safari 4 and Opera show memory usage degradation over time, while Chrome and Firefox 3.5 are more reliable in freeing memory to the OS." IE 8 was not included "because the author could not find a way to prevent it from opening a new window on each invocation of the command."
Summing the memory usage of all the Chrome processes is probably not the correct thing to do, as the memory usage indicated most likely includes shared libraries. I can't say this for sure about Vista, but on all sane operating systems, each shared library is loaded only once into memory, and then shared among different running programs.
If you are trying to explain the mechanism to a layman, you need to steer clear of terms like "processes" and "threads" as part of the explanation.
Imagine the memory in your computer is like a housing development. At first, there is a lot of open space. The open space can be partitioned so that houses can be built. Each of those houses represents a process. As long as you have more space, you can build more houses.
Inside each house, you have rooms. In computer terms, these would be threads. Each room has a specific job - kitchen, bedroom, bathroom. Sometimes you need more rooms, so you have to build them. This may mean that the size of the house needs to grow, and the amount of acreage the house needs must grow with it.
As long as a house exists, it will continue to occupy the space it is on. In computer terms, the process will hold on to the memory it has already claimed. However, the corollary to this is that when the house is torn down, all the land it occupied is returned to the "free acreage".
If a room is remodeled, it will not result in a change to the actual house size. Adding more rooms will always take up more land, but removing those rooms doesn't change the occupied land size at all.
In the same way, a process can grow and grow, but as soon as it completes (you close a tab in the browser), the memory will go back to the operating system so other processes can use it. But if the process does not complete because it uses threads to build those same tabs, then the process will continue to take up that memory.
Also consider that a house may burn down. If a problem happens in one room, a house-wide emergency may erupt. A fire in the kitchen may engulf the entire house and bring it down.
In a perfect world, what happens in one house should not affect other surrounding houses. If one house burns down, the other houses around it should be fine. Same with processes. If a thread in one process crashes, it may bring down the whole process. However, since processes are separated from each other, other processes should not be affected.
Then why use threads at all? Why not use processes all the time, since they are clearly safer. Well, why don't we only have one room in our house? Threads are needed within processes to perform important roles. Also, since they all exist in the same process, they can share information (like using light switches downstairs to control lights in the foyer). So a careful combination of threads and processes are necessary to create any kind of meaningful application. There is no right or wrong answer, but Google seems to think that isolating each browsing experience from another is the right way. Firefox thinks that putting all the rooms in one house and simply growing the house is the right way. Everyone is different.
I am sure that this is true for all of the browsers, but in Opera's case...
The machine has 4GB in question and Opera is set to "automatic" for the memory cache (default). According to this article, this instructs Opera to use up to ~10% of the system memory. This is quite tunable based on the environment, so one could easily optimize for a low-end machine and have satasfactory performance. The browser using the memory effectively is the more interesting test, which this benchmark fails to determine. An interesting detail in the graphs is how sharp the memory reclaim cycles are, where the smoother indicates better memory management. The graphs indicate that Opera does a good job in this regard.
Finally, this should stop perennial "firefox is a memory hog" trolls. Hopefully.
They weren't trolls. I've seen the memory leaks first hand. Plenty of people have posted OS memory usage screenshots. It may have been particular extensions or advanced settings that caused the problems but it was not some work of fiction.
You're the one trolling.
These posts express my own personal views, not those of my employer
Be glad you are not using Konqueror 3.5.10 or 4.2.4; /. makes a point of breaking rendering on those browsers every few weeks.
Random buttons and scroll-bars? Check.
Black text on black background? Check.
Utterly broken navigation so you can watch the front page and nothing else? Check.
CSS, Javascript and other crap in _plain text mode_? Check.
The only reason I keep coming back here for is the friendly discussion style ;)