CreateMemoryResourceNotification function (memoryapi.h)
Creates a memory resource notification object.
HANDLE CreateMemoryResourceNotification( [in] MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType );
The memory condition under which the object is to be signaled. This parameter can be one of the following values from the MEMORY_RESOURCE_NOTIFICATION_TYPE enumeration.
||Available physical memory is running low.|
||Available physical memory is high.|
If the function succeeds, the return value is a handle to a memory resource notification object.
If the function fails, the return value is NULL. To get extended information, call GetLastError.
Applications can use memory resource notification events to scale the memory usage as appropriate. If available memory is low, the application can reduce its working set. If available memory is high, the application can allocate more memory.
Any thread of the calling process can specify the memory resource notification handle in a call to the QueryMemoryResourceNotification function or one of the wait functions. The state of the object is signaled when the specified memory condition exists. This is a system-wide event, so all applications receive notification when the object is signaled. Note that there is a range of memory availability where neither the LowMemoryResourceNotification or HighMemoryResourceNotification object is signaled. In this case, applications should attempt to keep the memory use constant.
Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The memory resource notification object is destroyed when its last handle has been closed.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0501 or later. For more information, see Using the Windows Headers.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|Header||memoryapi.h (include Windows.h, Memoryapi.h)|