Kernel32OfferVirtualMemory(IntPtr, IntPtr, OfferVirtualMemoryPriority) Method

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(IntPtr, IntPtr) function.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
public static Win32ErrorCode OfferVirtualMemory(
	IntPtr address,
	IntPtr size,
	OfferVirtualMemoryPriority priority
)

Parameters

address  IntPtr
Page-aligned starting address of the memory to offer.
size  IntPtr
Size, in bytes, of the memory region to offer. size must be an integer multiple of the system page size.
priority  OfferVirtualMemoryPriority
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(IntPtr, IntPtr) function. The system typically discards lower priority memory before discarding higher priority memory.

Return Value

Win32ErrorCode
Returns ERROR_SUCCESS if successful. Returns a System Error Code (Win32ErrorCode) otherwise.

Remarks

See Also