MemoryManager MemoryManager MemoryManager MemoryManager Class

Definition

Provides access to information on an app's memory usage.

public : static class MemoryManager
public static class MemoryManager
Public Static Class MemoryManager
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

AppMemoryUsage AppMemoryUsage AppMemoryUsage AppMemoryUsage

Gets the app's current memory usage.

public : static ulong AppMemoryUsage { get; }
public static ulong AppMemoryUsage { get; }
Public Static ReadOnly Property AppMemoryUsage As ulong
var ulong = Windows.System.MemoryManager.appMemoryUsage;
Value
ulong ulong ulong ulong

The app's current memory usage.

AppMemoryUsageLevel AppMemoryUsageLevel AppMemoryUsageLevel AppMemoryUsageLevel

Gets the app's memory usage level.

public : static AppMemoryUsageLevel AppMemoryUsageLevel { get; }
public static AppMemoryUsageLevel AppMemoryUsageLevel { get; }
Public Static ReadOnly Property AppMemoryUsageLevel As AppMemoryUsageLevel
var appMemoryUsageLevel = Windows.System.MemoryManager.appMemoryUsageLevel;

AppMemoryUsageLimit AppMemoryUsageLimit AppMemoryUsageLimit AppMemoryUsageLimit

Gets the app's memory usage limit.

public : static ulong AppMemoryUsageLimit { get; }
public static ulong AppMemoryUsageLimit { get; }
Public Static ReadOnly Property AppMemoryUsageLimit As ulong
var ulong = Windows.System.MemoryManager.appMemoryUsageLimit;
Value
ulong ulong ulong ulong

The app's memory usage limit.

ExpectedAppMemoryUsageLimit ExpectedAppMemoryUsageLimit ExpectedAppMemoryUsageLimit ExpectedAppMemoryUsageLimit

Gets the amount of memory that your app may expect to have available.

public : static ulong ExpectedAppMemoryUsageLimit { get; }
public static ulong ExpectedAppMemoryUsageLimit { get; }
Public Static ReadOnly Property ExpectedAppMemoryUsageLimit As ulong
var ulong = Windows.System.MemoryManager.expectedAppMemoryUsageLimit;
Value
ulong ulong ulong ulong

The expected memory cap in bytes.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

When an app launches on Xbox, it is initially given a small app memory usage limit that may grow as the system frees memory. This property returns the expected upper limit that your app will be able to use.

When an app launches on a non-Xbox system, the memory usage limit the app gets at launch remains the same and this property will return the same value as Windows.System.MemoryManager.AppMemoryUsageLimit.

Methods

GetAppMemoryReport() GetAppMemoryReport() GetAppMemoryReport() GetAppMemoryReport()

Gets an AppMemoryReport for the app, which provides information about its memory usage.

public : static AppMemoryReport GetAppMemoryReport()
public static AppMemoryReport GetAppMemoryReport()
Public Static Function GetAppMemoryReport() As AppMemoryReport
var appMemoryReport = Windows.System.MemoryManager.getAppMemoryReport();
Returns

Information about the process' memory usage.

GetProcessMemoryReport() GetProcessMemoryReport() GetProcessMemoryReport() GetProcessMemoryReport()

Gets a ProcessMemoryReport for a process, which provides information about its memory usage.

public : static ProcessMemoryReport GetProcessMemoryReport()
public static ProcessMemoryReport GetProcessMemoryReport()
Public Static Function GetProcessMemoryReport() As ProcessMemoryReport
var processMemoryReport = Windows.System.MemoryManager.getProcessMemoryReport();
Returns

TrySetAppMemoryUsageLimit(UInt64) TrySetAppMemoryUsageLimit(UInt64) TrySetAppMemoryUsageLimit(UInt64) TrySetAppMemoryUsageLimit(UInt64)

Tries to set a specific memory cap for the current app or task. In cases where memory caps are shared between foreground and background components, any difference between the default cap and the new request will be assigned to the other component.

public : static Platform::Boolean TrySetAppMemoryUsageLimit(unsigned __int64 value)
public static bool TrySetAppMemoryUsageLimit(UInt64 value)
Public Static Function TrySetAppMemoryUsageLimit(value As UInt64) As bool
var bool = Windows.System.MemoryManager.trySetAppMemoryUsageLimit(value);
Parameters
value
unsigned __int64 UInt64 UInt64 UInt64

The new memory limit to set.

Returns
Platform::Boolean bool bool bool

True if the operation succeeded; otherwise, false.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Events

AppMemoryUsageDecreased AppMemoryUsageDecreased AppMemoryUsageDecreased AppMemoryUsageDecreased

Raised when the app's memory consumption has decreased to a lower value in the AppMemoryUsageLevel enumeration.

public : event EventHandler AppMemoryUsageDecreased<Platform::Object>
public event EventHandler AppMemoryUsageDecreased<object>
Public Event EventHandler AppMemoryUsageDecreased( Of ( Of object ))
function onAppMemoryUsageDecreased(eventArgs){/* Your code */}


memoryManager.addEventListener("appMemoryUsageDecreased", onAppMemoryUsageDecreased);
memoryManager.removeEventListener("appMemoryUsageDecreased", onAppMemoryUsageDecreased);

AppMemoryUsageIncreased AppMemoryUsageIncreased AppMemoryUsageIncreased AppMemoryUsageIncreased

Raised when the app's memory consumption has increased to a higher value in the AppMemoryUsageLevel enumeration.

public : event EventHandler AppMemoryUsageIncreased<Platform::Object>
public event EventHandler AppMemoryUsageIncreased<object>
Public Event EventHandler AppMemoryUsageIncreased( Of ( Of object ))
function onAppMemoryUsageIncreased(eventArgs){/* Your code */}


memoryManager.addEventListener("appMemoryUsageIncreased", onAppMemoryUsageIncreased);
memoryManager.removeEventListener("appMemoryUsageIncreased", onAppMemoryUsageIncreased);

AppMemoryUsageLimitChanging AppMemoryUsageLimitChanging AppMemoryUsageLimitChanging AppMemoryUsageLimitChanging

Raised just before the limit of how much total memory the app can use is changed.

public : event EventHandler AppMemoryUsageLimitChanging<AppMemoryUsageLimitChangingEventArgs>
public event EventHandler AppMemoryUsageLimitChanging<AppMemoryUsageLimitChangingEventArgs>
Public Event EventHandler AppMemoryUsageLimitChanging( Of ( Of AppMemoryUsageLimitChangingEventArgs ))
function onAppMemoryUsageLimitChanging(eventArgs){/* Your code */}


memoryManager.addEventListener("appMemoryUsageLimitChanging", onAppMemoryUsageLimitChanging);
memoryManager.removeEventListener("appMemoryUsageLimitChanging", onAppMemoryUsageLimitChanging);