The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DeviceStatus.ApplicationMemoryUsageLimit Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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.

Caution noteCaution:

When called from a Silverlight 8.1 app, this API always returns 0. To manage memory for Silverlight 8.1 apps, use the [] class instead.

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: 8.1, 8.0, 7.1

Windows Phone