C++ – the standby list in Windows memory management

cmemory-managementwindows

The memory management scheme in Windows is very complex, and I'm trying to understand it better so I can diagnose memory problems more accurately.

For example, our C++ application (in SysInternal's Process Explorer) shows 1.4GB "Virtual Size", 400MB "Private Bytes" and 366MB "Working Set".

I did some research and found this question:
What is private bytes, virtual bytes, working set?

This is a great read, but some things still don't add up. Specifically, the highest voted answer states that Virtual Bytes includes standby lists. I am not really sure what these are, and any research I've done has yielded less than friendly explanations of it. My biggest question is: How does moving pages to the standby list affect the application's virtual address space (if at all)? In other words, with a virtual size so much bigger than any other size, is the difference fragmented memory?

If anyone can help me understand this a little better I'd greatly appreciate it. Thanks in advance!

Best Answer

In a simple scenario, a page that hasn't been used for a while would be removed from a process, cleared and put on a free list, so that any other process could utilize it when more memory's needed.

With a standby list, the page is removed from the process, not modified, and put on a standby list. If the same process happen to need the page, it's returned immediately. If another process needs more memory, the page is cleared and given to that process.

So, in short, the memory manager keeps initialized memory around just in case the process originally using it should want it back - but if someone else wants more memory they'll get it instead.