PAGE_READONLY May Be Used as Discardable Memory (94947)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows NT 3.1
- the operating system: Microsoft Windows NT 3.5
- the operating system: Microsoft Windows NT 3.51
This article was previously published under Q94947
Virtual memory pages marked as PAGE_READONLY under Win32 may be used the
way discardable segments of memory are used in Windows 3.1. These virtual
memory pages are by default not "dirty," so the system may use them
(zeroing them first if necessary) without having to first write their
contents to disk.
From a system resource perspective, PAGE_READONLY is treated similar to
discardable memory under Windows 3.1 when the system needs to free up
resources. From a programming standpoint, the system automatically re-reads
the memory when the data is next accessed (for example, we attempt to
access our page when it has been "discarded," a page fault is generated,
and the system reads it back in). Memory-mapped files are convenient for
setting up this type of behavior.
If a PAGE_READONLY memory page becomes dirty [by changing the protection
via VirtualProtect() to PAGE_READWRITE, changing the data, and restoring
PAGE_READONLY], the page will be written to disk before the system uses it.
Modification Type: | Major | Last Reviewed: | 4/15/2004 |
---|
Keywords: | KB94947 |
---|
|