views:

298

answers:

3

Is it correct to assume that the total memory consumption (virtual + physical) of a system is sum of "Memory Usage" and "VM Size" columns shown by the task manager in windows?

+1  A: 

No, physical memory and virtual memory may overlap. If a page of memory is in virtual memory and then paged in to physical memory the virtual memory is not necessarily freed, it may be reserved for when the page gets paged out again.

Motti
But still that is the memory consumed. Even though its sort of getting wasted. Its ok with me if even its about to garbage collected. as long as its been used its acceptable. I am more interested in is there any thing else beside these two column? (perhaps internal kernal memory usage thats not been shown in task manager)
Umair Ahmed
+2  A: 

In modern Windows there really is no single truth about "Total Memory Consumption". It depends of course on the definition, but the real question is what you want to do with the answer.

Some processes like SQL-Server tend to use every byte of memory they can get their hands on, if you let them. The .NET CLR garbage collector monitors memory use and acts accordingly, trying to free more memory when it gets scarce.

So for instance you can have a system with 8 GB of physical memory, of which 90% is "used". How much of that memory is actually needed, is very hard to say. The same system may run on a 4 GB machine with no noticeable performance loss or any other issues.

If you want to explore some of the complexities of memory management under Windows, download "VMMap v2.0" from the former sysinternals site. It shows very detailed memory usage per process and may aid you in your quest.

To quote from VMMaps Help: VMMap categorizes memory into one of several types:

Image The memory represents an executable file such as a .exe or .dll. The Details column shows the file's path.

Private Private memory cannot be shared with other processes, is charged against the system commit limit, and typically contains application data.

Shareable Shareable memory can be shared with other processes, is charged against the system commit limit and typically contains data shared between DLLs in different processes or inter-process communication messages. The Windows APIs refer to this type of memory as pagefile-backed sections.

Mapped File The memory represents a file on disk and the Details column shows the file's path. Mapped files typically contain application data.

Heap Heaps represent memory managed by the user-mode heap manager and, like Private memory, is charged against the system commit limit and contains application data.

Managed Heap Managed heap represents memory that's allocated and used by the .NET garbage collector.

Stack Stacks are memory used to store function parameters, local function variables and function invocation records for individual threads. Stacks are charged agains the commit limit and typically grow on demand.

System System memory is kernel-mode physical memory associated with the process. The vast majority of System memory consists of the process page tables.

Free Free memory regions are spaces in the process address space that are not allocated.

Now you just need to define what types of memory you consider as "used", add these up for all processes, remove multiple duplicates and look at the number... There is a reason why in task manager or other tools, there is no single number labeled "Total Memory Consumption" :-)

TToni
+4  A: 

Read these posts by Mark Russinovich:

http://blogs.technet.com/markrussinovich/archive/2008/07/21/3092070.aspx

http://blogs.technet.com/markrussinovich/archive/2008/11/17/3155406.aspx

zvolkov
Yes, Mark provides great insight into the guts of Windows.
Simon H.