0
votes

I have a Windows Phone background agent that I am debugging using the Emulator 720P which is supposed to have 1GB of Memory.

According to this article, the agent on such a device can use up to 20MB of memory.

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202942%28v=vs.105%29.aspx

However, when I debug through the agent using

Microsoft.Phone.Info.DeviceStatus.ApplicationMemoryUsageLimit / 1024;

I get 11MB returned.

I also tried an actual phone that has more than 1GB of RAm and still get the same result.

Am I doing something wrong here?

1
Yeah this 20 MB mentioned on MSDN has always puzzled me. You may want to add the ID_FUNCCAP_EXTEND_MEM capability to the manifest and see if it changes anything: msdn.microsoft.com/en-us/library/windowsphone/develop/… - Kevin Gosse
Yeah it's 11MB on my 1GB emulator too. But on my real 2GB device, I have 31MB capacity. I was doing an intensive work there and usually kicked out on emulator. - Khoi

1 Answers

2
votes

11 MB is the correct limit. You misread the part where the documentation mentions about audio agents.

Periodic agents and resource-intensive agents can use no more than 20 MB of memory at any time on devices with 1 GB of memory or more. On lower-memory devices, the limit is 11 MB. Audio agents have the memory caps described below. If a Scheduled Task exceeds these memory caps, it is terminated immediately.

The RAM that you have on your device does not really matter. This is a soft limit put on by the OS to limit resource usage. By my experience this memory limit is enough to generate tiles and checking location etc.