Skip to content

Latest commit

 

History

History
169 lines (122 loc) · 5.52 KB

nf-memoryapi-offervirtualmemory.md

File metadata and controls

169 lines (122 loc) · 5.52 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:memoryapi.OfferVirtualMemory
OfferVirtualMemory function (memoryapi.h)
Indicates that the data contained in a range of memory pages is no longer needed by the application and can be discarded by the system if necessary.
OfferVirtualMemory
OfferVirtualMemory function
VMOfferPriorityBelowNormal
VMOfferPriorityLow
VMOfferPriorityNormal
VMOfferPriorityVeryLow
base.offervirtualmemory
winbase/OfferVirtualMemory
base\offervirtualmemory.htm
base
45f8a433-0a9e-31d1-f21d-a17d7247e164
12/05/2018
OfferVirtualMemory, OfferVirtualMemory function, VMOfferPriorityBelowNormal, VMOfferPriorityLow, VMOfferPriorityNormal, VMOfferPriorityVeryLow, base.offervirtualmemory, winbase/OfferVirtualMemory
memoryapi.h
Windows.h, Memoryapi.h
Windows
Windows 8.1 Update [desktop apps \| UWP apps]
Windows Server 2012 R2 Update [desktop apps \| UWP apps]
onecore.lib
Kernel32.dll
Windows
19H1
OfferVirtualMemory
memoryapi/OfferVirtualMemory
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-Core-memory-l1-1-2.dll
KernelBase.dll
API-MS-Win-Core-memory-l1-1-3.dll
MinKernelBase.dll
API-MS-Win-Core-Memory-L1-1-4.dll
OfferVirtualMemory

OfferVirtualMemory function

-description

Indicates that the data contained in a range of memory pages is no longer needed by the application and can be discarded by the system if necessary.

The specified pages will be marked as inaccessible, removed from the process working set, and will not be written to the paging file.

To later reclaim offered pages, call ReclaimVirtualMemory.

-parameters

-param VirtualAddress [in]

Page-aligned starting address of the memory to offer.

-param Size [in]

Size, in bytes, of the memory region to offer. Size must be an integer multiple of the system page size.

-param Priority [in]

Priority indicates how important the offered memory is to the application. A higher priority increases the probability that the offered memory can be reclaimed intact when calling ReclaimVirtualMemory. The system typically discards lower priority memory before discarding higher priority memory. Priority must be one of the following values.

Value Meaning
VMOfferPriorityVeryLow
0x00000001
The offered memory is very low priority, and should be the first discarded.
VMOfferPriorityLow
0x00000002
The offered memory is low priority.
VMOfferPriorityBelowNormal
0x00000003
The offered memory is below normal priority.
VMOfferPriorityNormal
0x00000004
The offered memory is of normal priority to the application, and should be the last discarded.

-returns

ERROR_SUCCESS if successful; a System Error Code otherwise.

-remarks

To reclaim offered pages, call ReclaimVirtualMemory. The data in reclaimed pages may have been discarded, in which case the contents of the memory region is undefined and must be rewritten by the application.

Do not call OfferVirtualMemory to offer virtual memory that is locked. Doing so will unlock the specified range of pages.

Note that offering and reclaiming virtual memory is similar to using the MEM_RESET and MEM_RESET_UNDO memory allocation flags, except that OfferVirtualMemory removes the memory from the process working set and restricts access to the offered pages until they are reclaimed.

-see-also

DiscardVirtualMemory

Memory Management Functions

ReclaimVirtualMemory

Virtual Memory Functions

VirtualAlloc

VirtualFree

VirtualLock

VirtualQuery