Zeroing out my memory does cause them to page in faster after all

Raymond Chen

Not too long ago, I answered the question “If I zero out my memory pages, does that make them page in faster?” with “No.”

Turns out that I was working from outdated information.

My former colleague Adrian Oney (who, among other things, has shared with us the story of the USB Cart of Death) confirms the information in the white paper shared by commenter John Doe, namely that starting in Windows Vista, the memory manager does check whether a page that is about to paged out consists entirely of zeroes. If so, then the memory manager turns the page into a demand-zero page rather than a page stored in the pagefile (that happens to contain nothing but zeroes).

Adrian said that he wrote the original prototype which confirmed that the extra check was worth it. “Some of this was due to apps dirtying their zero-init pages with inits to zero. Some of it was due to user mode zeroing pages for security reasons. But it was common enough to make it worthwhile.”

I suspect that the increasing use of virtualization may contribute to this virtuous cycle as well. If the app is running in a virtual machine, then it’s a big win to avoid having to perform virtualized I/O.


Discussion is closed.

Feedback usabilla icon