Expand Minimize

CreateMemoryResourceNotification function

Creates a memory resource notification object.

Syntax


HANDLE WINAPI CreateMemoryResourceNotification(
  _In_  MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
);

Parameters

NotificationType [in]

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.

ValueMeaning
LowMemoryResourceNotification
0

Available physical memory is running low.

HighMemoryResourceNotification
1

Available physical memory is high.

 

Return value

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.

Remarks

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.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

CloseHandle
Memory Management Functions
QueryMemoryResourceNotification

 

 

Community Additions

ADD
Show:
© 2014 Microsoft