Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ReclaimVirtualMemory function

Reclaims a range of memory pages that were offered to the system with OfferVirtualMemory.

If the offered memory has been discarded, the contents of the memory region is undefined and must be rewritten by the application. If the offered memory has not been discarded, it is reclaimed intact.

Syntax


DWORD WINAPI ReclaimVirtualMemory(
  _In_ PVOID  VirtualAddress,
  _In_ SIZE_T Size
);

Parameters

VirtualAddress [in]

Page-aligned starting address of the memory to reclaim.

Size [in]

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

Return value

Returns ERROR_SUCCESS if successful and the memory was reclaimed intact.

Returns ERROR_BUSY if successful but the memory was discarded and must be rewritten by the application. In this case, the contents of the memory region is undefined.

Returns a System Error Code otherwise.

Remarks

Reclaimed memory pages can be used by the application, and will be written to the system paging file if paging occurs.

If the function returns ERROR_SUCCESS, the data in the reclaimed pages is valid. If the function returns ERROR_BUSY, the data in the reclaimed pages was discarded by the system and is no longer valid. For this reason, memory should only be offered to the system if the application does not need or can regenerate the data.

Requirements

Minimum supported client

Windows 8.1 Update [desktop apps | UWP apps]

Minimum supported server

Windows Server 2012 R2 Update [desktop apps | UWP apps]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

Memory Management Functions
Virtual Memory Functions
OfferVirtualMemory
VirtualAlloc
VirtualFree
VirtualLock
VirtualQuery

 

 

Show: