Innuendo and out the other

About Opera and stuff

Opera, memory usage and the working set

, ,

There's a commom misconception that the working set of an application, as seen in the task manager, is the amount of physical memory the application is using. This is not entirely correct.

The working set actually tells you how many virtual pages in the process are mapped into physical memory.

What the OS will do, when an application such as Opera is using external DLLs or even other parts of opera.dll, is to map that part of the dll into the virtual address space of Opera. The actual memory used will not increase, only the working set.

To use an example for the technical people out there:

  1. Open a file
  2. Call CreateFileMapping to create a mapping handle
  3. Call MapViewOfFile twice to create two different identical views on the same file
  4. Try looping through just one of the views and look at what that does to your process' working set
  5. Now try looping through both views and look at what that does to your process' working set


The result you will find is that the working set from #5 is double the working set from #4. However, the OS isn't using any more physical memory in #5 then in #4. So #5 will show as twice the memory used in the task manager, but in reality, there is very little difference in the physical memory used!

Now, if you minimize Opera, you will see that the memory used in task manager will decrease significantly. This is because the working set is freed by the OS.

Another thing worth noting is that plugins will add to the working set of Opera, some in a significant way.

I hope this clears up some points.

Desktop Team blog and weekly buildsThe arrogance of larger companies

Comments

gun Monday, March 6, 2006 6:23:47 PM

I always told people to minimize Opera if they are concerned about it's memory usage. I'll now point to this blog if people are yelling "Opera is a memory hog". wink

chesss Tuesday, March 7, 2006 8:42:56 AM

Nice, really nice!!

But then how to find out the actual memory consumption of a process?

Petter Nilsenmitchman2 Tuesday, March 7, 2006 10:09:43 AM

Download http://www.sysinternals.com/Utilities/ProcessExplorer.html and add the Private Bytes column to the process view, that should show that memory allocated by the application that can not be shared with other applications (hence the naming "private").

jp10558 Tuesday, March 7, 2006 3:51:10 PM

So, I'm pretty confused then. How can private bytes be more than the working set?

I have 1GB RAM. 92,920K private bytes, 436,056 Virtual Size, 61,840 Working set.

Can someone lead me through this?

Petter Nilsenmitchman2 Tuesday, March 7, 2006 6:02:13 PM

Private Bytes is not included in the working set.

Petter Nilsenmitchman2 Thursday, March 9, 2006 10:53:37 AM

The Task Manager will show Private bytes + working set in its memory column.

shogunu Saturday, March 11, 2006 6:29:59 PM

Right now, the Private bytes are 80668 K, the Working set is 73284 K and the Task Manager shows 73284 K Memory usage.
So how is it actually?

Petter Nilsenmitchman2 Sunday, March 12, 2006 6:20:22 PM

I was incorrect, VM Size in task manager is the same as the the process explorer's private bytes setting, and it appears that the mem use in task manager is the working set, and nothing else.

Better use process explorer smile

chesss Monday, March 13, 2006 9:49:30 PM

So finally how do you see the actual memory?? Currently Opera's usage as shown in process explorer :
Private bytes: 86mb
virtual bytes: 187mb
working sets: 24mb

System memory:256mb, Opera is minimized

chesss Monday, March 13, 2006 10:02:40 PM

I found something:
http://shsc.info/WindowsMemoryManagement

- for anyone interested to know how all this works(its a lot more complicated than I ever thought), or just interested in getting a headache or just to get throughly confused.

tony2006 Thursday, April 20, 2006 2:27:37 AM

i just have registered on this web.
eXtended Task Manager (XTM) is a powerful auxiliary tool designed for simplifying the environment of the software developer. XTM is an extended windows task manager and performance monitoring tool for Microsoft Windows 2000 OS and later versions of Windows. XTM can give fast solutions for sudden problems which may arise in a product's functioning without having to either reinstall it from the user workstation or even without needing to close the application.
http://www.yaodownload.com/utilites/system-utilities/extended-task-manager/

null-a Saturday, June 10, 2006 5:18:14 PM

well, previous versions of opera didn't have this 'problem'. it only started with version 9. until then it used to have a very small 'memory print'. (i'm not a developer, so technical jargon might be missemployed). Thx.

dbw Sunday, July 22, 2007 11:51:23 PM

Using my linux installation of Opera, I have examined my my ram usage. I've noticed that each cycle of opening and closing Opera increases the total amount of memory being used. This usage persists, even over night. This means I often have 200-300mb of spurious memory usage which is only corrected by a hard reboot. Any suggestions?

Petter Nilsenmitchman2 Tuesday, July 24, 2007 3:17:07 PM

That sounds like the dynamic memory cache might be filling up. You don't say what version of Opera you use, though.

SamDontGoHere Saturday, August 18, 2007 3:24:48 AM

So on average, does Opera use less memory than Firefox?

Petter Nilsenmitchman2 Monday, August 20, 2007 10:40:17 PM

I haven't done any measurement myself, but it seems to be the common conclusion, yes.

ebulfin Friday, December 14, 2007 11:57:57 AM

This all sounds great, and the explanation is a fair comment on how the memory is calculated, but how come Opera is using more memory on my XP Pro set-up, than any other program, and carries on using (or hogging) that memory even after closing opera. It remains in my Task Manager as the largest single user of memory, yet I have closed Opera.

Sorry to have just repeated myself, but I explained this to someone else and the first E-mail back suggested I close Opera and reopened it ............ Been there, done that and got the tee shirt.

The next question back from support was about the version, so here is my set-up:
Version information
Version: 9.24
Build: 8816
Platform: Win32
System: Windows XP
Java: Sun Java Runtime Environment version 1.6
XHTML+Voice; IBM Multimodal Runtime Environment, Version: 4.1.3, Build: 20050506.01.1

Petter Nilsenmitchman2 Monday, December 17, 2007 2:02:57 PM

Try setting the memory cache to a fixed value instead of automatic in Tools->Preferences->Advanced->History.

Naveennaveen_reloaded Sunday, December 30, 2007 9:02:55 AM

may be i am totally out of topic ..
but why does the memory usage keeps on increasing with the hour os usage??

Corycmawhorter Tuesday, January 22, 2008 11:16:47 AM

I love opera. It is the superior browser (for me) by far. I arrived at your page after noticing Opera routinely used ~500MB of memory (working+private).

Thank you for the tip in the comments to change the memory cache setting. I changed it from automatic to 60MB, the largest available. Opera is now holding steady at ~250MB. I don't mind as long as I know where the memory is going. For comparison Firefox is usually the same or higher.

Thanks for the post. BTW... using opera 9.25

Brucesbruce45 Friday, May 30, 2008 12:33:12 PM

This discussion has been a real eyes-opener for me and the heavy usage of memory by Opera. Thanks.

Rajiv Abrahammoserw Thursday, July 17, 2008 5:40:44 PM

mitchman2,

Thanks for pointing out to Tools->Preferences->Advanced->History. I had forgotten about it and Opera was going real slow on my system. Now I have optimized the settings and its a breeze as before. Much appreciated.

rsriv Wednesday, November 26, 2008 4:04:33 AM

You guys are all talking about memory usage, but what is surprising for me is the CPU resources Opera hogs on closing (98-99%). Moreover this persists for a substantial time slowing down all other applications running on the machine. CPU usage also shoots up after some time while browsing, and things get so slow that I cannot even change tabs - Opera just freezes for a couple of minutes.

While I am a dedicated Opera user since version 4.0, this new problem (for me since version 9.5) is giving me second thoughts.

vipin kumarmvk6 Monday, February 22, 2010 12:44:27 AM

Thanks a lot for the article!!

cyberdude mminicyberdude Monday, February 22, 2010 4:39:38 AM

what is memory cache i should set
1gb ram windows 7 32 bit
is it anyway related to "speed with which the page loads"
i mean does loading the page occurs as fast as before when it was set to automatic.............

vipin kumarmvk6 Monday, February 22, 2010 12:13:16 PM

I have xp sp2 and 1 gb ram.. what memory cache should I set?! System uses 350 RAM on an average!

IanArimus Wednesday, January 5, 2011 9:40:47 AM

I love Opera but I am seeing a HUGE difference. I have Firefox en Opera both open with the same tabs/websites open. My result:
Firefox: 82.880
Opera: 241.572

Having 6GB of ram means it doesn't bother me that much but I just think it is an excessive amount for a browser.

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.