Microsoft KB Archive/162104

= DOC: VirtualAlloc Doc Missing MEM_RESET Description =

ID: Q162104

4.00 WINDOWS NT DOCERR

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: KBSubcategory: BseMem Additional reference words: 4.00 kbdss docerr docerror virtualalloc

Keywords         : kbdocerr kbAPI kbKernBase kbGrpKernBase Version          : WINNT:4.0 Platform         : winnt Last Reviewed: May 23, 1998