Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "Virtual Size" in sysinternals process explorer

My application runs for few hours, There is no increase in any value ( vmsize, memory) of Task Manager. But after few hours i get out of memory errors.

In sysinternals i see that "Virtual Size" is contineously increasing, and when it reach around 2 GB i start getting memory errors.

So what kind of memory leak is that ? How can i demonstrate it with a code ? Is it possible to reproduce same thing with any piece of code where none of the memory value increase but only the Virtual Size in sysinternsl process explorer increase ?

thanks for any suggestions

like image 417
robert Avatar asked Jun 12 '10 22:06

robert


People also ask

What is the virtual size?

Virtual size is the number of pages that the process has allocated, those pages not currently in the working set (physically loaded in RAM) will be in the system's page file. Typically you allocate memory that is not freed.

What is virtual bytes in IIS worker process?

Virtual Bytes are the total amount of virtual address space that a process occupies.

What is virtual bytes peak in performance counter?

The Virtual Bytes counter indicates the current size of the virtual address space that the process is using. Some memory leaks appear in the data file as an increase in private bytes allocated. Other memory leaks show up as an increase in the virtual address space.

What is the commit size?

Commit size is a measure of the size of each commit—the sum of additions and deletions—integrated to trunk/main. Additions and deletions represent lines of code added or deleted. For example, if a commit adds 20 new lines of code and removes 15 lines of code, the commit size is 35 lines of code.


2 Answers

Virtual size is the number of pages that the process has allocated, those pages not currently in the working set (physically loaded in RAM) will be in the system's page file.

Typically you allocate memory that is not freed. This can be difficult to track down in the code without special tools like Rational Purify or Boundschecker for example. With sysinternals you see that there must be leak but it won't by no mean tell you where...

If your software is not so big you can try to log out the "new" and "delete" and see if there are too many objects in memory by managing lists of allocated objects (making your own memory debugger so to say). There are some helpers in the windows world like the CRT memory checking utils from Microsoft. They are useful in some cases.

like image 61
jdehaan Avatar answered Sep 19 '22 09:09

jdehaan


From the sound of things, you're running out of address space. 32-bit Windows splits the address space in half, one half for the user program and one half for the system, so each gets 2 Gigabytes.

The most common cause of this is fragmenting the memory space to the point that you can't find a chunk that's big enough for an allocation. Unfortunately, without knowing more about what you're doing, it's hard to guess why that might be happening though.

like image 42
Jerry Coffin Avatar answered Sep 21 '22 09:09

Jerry Coffin