{"id":94675,"date":"2016-11-09T07:00:00","date_gmt":"2016-11-09T22:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=94675"},"modified":"2019-03-13T10:33:31","modified_gmt":"2019-03-13T17:33:31","slug":"20161109-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20161109-00\/?p=94675","title":{"rendered":"Zeroing out my memory does cause them to page in faster after all"},"content":{"rendered":"<p>Not too long ago, I answered the question &#8220;If I zero out my memory pages, does that make them page in faster?&#8221; with &#8220;<a HREF=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/\">No<\/a>.&#8221; <\/p>\n<p>Turns out that I was working from outdated information. <\/p>\n<p>My former colleague Adrian Oney (who, among other things, has shared with us the story of the <a HREF=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/#comment-198323\">USB Cart of Death<\/a>) confirms the information in <a HREF=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dn613877.aspx\">the white paper shared by commenter John Doe<\/a>, 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). <\/p>\n<p>Adrian <a HREF=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/#comment-1264885\">said<\/a> that he wrote the original prototype which confirmed that the extra check was worth it. &#8220;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.&#8221; <\/p>\n<p>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&#8217;s a big win to avoid having to perform virtualized I\/O. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to a special check in the memory manager.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-94675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Thanks to a special check in the memory manager.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=94675"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/94675\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=94675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=94675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=94675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}