DOC: VirtualAlloc Doc Missing MEM_RESET Description

Last reviewed: January 15, 1998
Article ID: Q162104
4.00 WINDOWS NT DOCERR kbprg kbdocerr

The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT version 4.0

SUMMARY

A description of the MEM_RESET flag is missing from the VirtualAlloc() portion of the Win32 SDK documentation. This article contains the missing information. Windows NT 4.0 added a new flag, MEM_RESET, to the VirtualAlloc API. The MEM_RESET flag allows you to specify that specific memory pages will neither be written to nor read from the paging file.

MORE INFORMATION

The MEM_RESET flag specifies that memory pages within the range specified by lpAddress and dwSize will not be written to nor read from the paging file.

When you set the MEM_RESET flag, you are declaring that the contents of that range are no longer important. The range is going to be overwritten, and the application does not want the memory to migrate out to or in from the paging file.

Setting this flag does not guarantee that the range operated on with MEM_RESET will contain zeroes. If you want the range to contain zeroes, decommit the memory and then recommit it.

When you set the MEM_RESET flag, the VirtualAlloc function ignores the value of fProtect. However, you must still set fProtect to a valid protection value, such as PAGE_NOACCESS.

VirtualAlloc returns an error if you set the MEM_RESET flag and the range of memory is mapped to a file. A shared view is only acceptable if it is mapped to a paging file.


KBCategory: kbprg kbdocerr
KBSubcategory: BseMem
Additional reference words: 4.00 kbdss docerr docerror virtualalloc()
Keywords : BseMm
Version : WINNT:4.0
Platform : winnt
Issue type : kbdocerr


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.