App memory limits for Windows Phone 8
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
We designed Windows Phone 8 to help you distribute your app to the broadest market possible. To help you accomplish this, when you design an app for lower-memory devices, which typically means phones with no more than 512 MB of memory, you can use any Windows Phone 8 feature you might use on higher-memory phones. However, every Windows Phone 8 app has a default cap on the amount of memory it can use, to ensure a good user experience for all tasks running on the phone. To maintain a quality app experience on all phones, you can request a higher memory cap for your app, or you can opt out of having your app available to install on a lower-memory device. Here, you can learn about memory limits for Windows Phone 8 apps, how to request a higher memory limit for your app, and how you can opt out of making your app available to install on lower-memory devices.
This topic contains the following sections.
- Memory limit by app type
- Memory-related manifest entries
- Related Topics
Memory limit by app type
The size of the default memory cap imposed on an app is determined by the type of the app as well as by the memory size of the device. The size of the higher memory cap that can be requested is determined solely by the memory size of the device. Typically, a phone with 512 MB of memory is considered a lower-memory device, but this can vary depending on the device. For example, if a phone has a high-resolution camera, for app purposes it may be considered a lower-memory device. The following table lists the default and higher memory caps in these categories.
App type |
Lower-memory phones |
1-GB phones |
2-GB phones |
|
---|---|---|---|---|
Windows Phone 8.0 (all types) |
180 MB |
380 MB |
780 MB |
|
Silverlight 8.1 and Windows Runtime 8.1 |
185 MB |
390 MB |
825 MB |
|
Continuous Background Execution (Windows Phone 8.0 only) |
150 MB |
150 MB |
300 MB |
To use the memory limits described in the preceding table, 2-GB phones must also have Windows Phone 8 Update 3 (that is, a version equal to or greater than 8.0.10492).
You can check the memory limit available to your app by checking the ApplicationWorkingSetLimit value using the DeviceExtendedProperties..::.GetValue(String) method. For an example of how to do this, see How to disable features in apps for lower-memory phones for Windows Phone 8.
Key changes to memory limits starting in Windows Phone 8.1 include:
All Windows Phone 8 foreground apps are treated the same. We no longer have different memory caps for XNA, native or Silverlight apps.
Windows Phone 8.1 apps (including both Silverlight 8.1 and Windows Runtime) apps do have slightly higher caps than Windows Phone 8 apps.
Memory caps for all app types, including Continuous Background Execution (CBE), scale up with increased memory.
There is no longer a "default" and "higher" cap - there is only the default cap.
The ID_FUNCCAP_EXTEND_MEM manifest entry is ignored for all apps running on Windows Phone 8.1.
The ID_REQ_MEMORY_300 manifest entry is still valid, but you should really make your app run on all devices.
The new equivalent of ID_REQ_MEMORY_300 is below. This entry should be added to the AppX manifest (not to the WMAppManifest).
<Prerequisites> <m3:MinDeviceMemory>1GB</m3:MinDeviceMemory> </Prerequisites>
Memory-related manifest entries
Although for optimal market reach you should design your app to run using the default memory cap for lower-memory phones, you can request more memory or you can opt out of lower-memory phones completely. If you want your app to be available to all phones, but with the possibility of impacting other phone tasks by utilizing more memory, you must add a FunctionalCapability entry to the app manifest file. To opt out of lower-memory devices, you must add a Requirements entry to the manifest.
The following table lists the entries you use in your app manifest file that can affect the memory limit of your app.
Manifest entry |
Description |
Result |
---|---|---|
ID_FUNCCAP_EXTEND_MEM |
Doesn’t opt out of lower-memory devices (installs on all devices), but is granted the higher memory allocation instead of the default lower level. |
Enforces the maximum memory limit by phone type: 180 MB on lower-memory phones; 380 MB on phones with > 1-GB memory. |
ID_REQ_MEMORY_300 |
Completely opts out of availability for lower-memory phones. |
The app won’t appear in the Windows Phone Store for lower-memory phones and it can’t be installed on lower-memory phones. |
These entries must be added manually to the manifest file and will not display in the Manifest Editor tool.
The FunctionalCapability element is a child of the FunctionalCapabilities element, which is a child of the App element. The FunctionalCapabilities element should be added after other children of the App element including the Requirements element, if both are present, or the manifest will not validate. Following is an example of the FunctionalCapabilities element.
<App>
…
<Requirements>
<Requirement Name="ID_REQ_FRONTCAMERA"/>
</Requirements>
<FunctionalCapabilities>
<FunctionalCapability Name="ID_FUNCCAP_EXTEND_MEM"/>
</FunctionalCapabilities>
</App>
The Requirement element is a child of the Requirements element, which is a child of the App element. The Requirements element should be listed after other elements in the App element, but before the FunctionalCapabilities element, if both are present. Following is an example of the Requirements element.
<App>
…
<Requirements>
<Requirement Name="ID_REQ_FRONTCAMERA" />
<Requirement Name="ID_REQ_MEMORY_300" />
</Requirements>
</App>
For more information on how to edit the manifest file, see How to modify the app manifest file for Windows Phone 8.
For more info about the app manifest file and app capabilities and requirements, see App manifest file for Windows Phone 8 and App capabilities and hardware requirements for Windows Phone 8. For more info about detecting the amount of memory available to your app, and for info about how to disable features in your app to meet memory limits, see How to disable features in apps for lower-memory phones for Windows Phone 8.
See Also
Other Resources
How to disable features in apps for lower-memory phones for Windows Phone 8
App capabilities and hardware requirements for Windows Phone 8