开发者

What is "Virtual Size" in sysinternals process explorer

开发者 https://www.devze.com 2023-01-03 19:02 出处:网络
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.

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 incre开发者_如何学编程asing, 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


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.


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.


According to this thread on the sysinternals forum, Virtual size corresponds to the address space of the process (I'm guessing commited and reserved pages of memory)


It seems that Virtual Size includes allocated pages with following types: MEM_MAPPED (for data views) MEM_IMAGE (for executable image views) MEM_PRIVATE (usual allocated page memory)

It's not the only "memory" for data, but also includes page space for *.dll-s and FileMapping mechanism.

0

精彩评论

暂无评论...
验证码 换一张
取 消