Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify the memory limit per app in Windows 10 Universal Applications

Tags:

memory

limit

uwp

In our tests, seems that memUsageLimit is fixed in function of installed RAM and platform. For smartphones (mostly ARM processors) the limits are

185 MB for 512 MB RAM device
390 MB for 1GB RAM device
900 MB for 2GB RAM device

For regular Windows + Intel platforms, we found the limit is about 20% more than physical available RAM, perhaps due to the ability of paging to disk.

My question is regarding the first group of devices (phones): is it possible to change the memory limit for a given application? We need to process a JSON document received via oData V4, and when processing with NewtonSoft, the memory consumption is very significant: for every MB of pure JSON data, the app process is increased about 9MB in a very linear fashion.

like image 500
Carlos Alejandro Pérez Avatar asked Nov 24 '15 11:11

Carlos Alejandro Pérez


People also ask

How do I allocate more memory to a program in Windows 10?

Allow Windows 10 to Allocate More RAMFind the This PC application and right-click the icon, then select Properties. Select Advanced system settings > Settings. Under the Visual Effects tab, there are four options. Select the Adjust for best performance option.


1 Answers

Win10 1.586 does provide a new API, TrySetAppMemoryUsageLimit, to set the app's memory limitation. However, based on internal discussion, this API only works for very limited scenario right now, such as VOIP application on mobile device. And the sample code and document for this API are not quite ready.

I have tested this API on the UWP VOIP sample and it does work(we need to set the sample project's target to 10586). The code looks like below:

var y = MemoryManager.AppMemoryUsageLimit;
bool result = MemoryManager.TrySetAppMemoryUsageLimit(y+10000);

As for your requirement, we will keep collecting the feedback about this feature. If there is any strong requirement, we will communicate with internal team. However, my personal suggestion for you is that: win store app has very strong safety policy for the apps. It is really not recommended for APP to exceed memory limitation.

like image 74
Fangfang Wu - MSFT Avatar answered Nov 15 '22 07:11

Fangfang Wu - MSFT