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.
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
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: |
|---|
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: |
|---|
When called from a Silverlight 8.1 app, this API always returns 0. To manage memory for Silverlight 8.1 apps, use the [http://go.microsoft.com/fwlink/p/?LinkId=394902] 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;
Caution: