1 out of 3 rated this helpful - Rate this topic

DeviceStatus.ApplicationMemoryUsageLimit Property

July 26, 2012

Returns the maximum amount of memory that your application process can allocate in bytes.

Namespace:  Microsoft.Phone.Info
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)
public static long ApplicationMemoryUsageLimit { get; }

Property Value

Type: System.Int64
Returns Int64.

If your application tries to allocate more memory than is available on the device, the application will terminate with an OutOfMemoryException. You can use this property to help prevent that scenario from happening.

Caution noteCaution:

The value returned by this property can vary depending on the type of process that called the property, and the current amount of available memory on the device. For example, the amount of memory that a background agent process can allocate could be different than the amount that a foreground application process can allocate. For this reason, do not assume that your process will always have access to the same amount of memory.

The following code example shows how you can use this property, and the ApplicationCurrentMemoryUsage property, to determine the maximum additional amount of memory that your application process can allocate.

long x = DeviceStatus.ApplicationMemoryUsageLimit – DeviceStatus.ApplicationCurrentMemoryUsage;

Windows Phone OS

Supported in: 7.1

Windows Phone

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.