Windows Phone Mango - Memory constraint (6 MB) issue
As per documentation, background task cannot use more than 6 MB of memory. I ran background task without any code as follows:
protected override void OnInvoke(ScheduledTask task)
{
Debug.WriteLine("Available Memory: " + (DeviceStatus.ApplicationMemoryUsageLimit - DeviceStatus.ApplicationCurrentMemoryUsage).ToString());
Debug.WriteLine("Peak Memory: " + DeviceStatus.ApplicationPeakMemoryUsage.ToString());
NotifyComplete();
}
The code does not contain any logic. Just writing to output window about available memory.
Following is the output of the above:
Available Memory: 1863680
Peak Memory: 4435968What I am wondering is, without writing any code or allocating memory to object, how is my 4435968 bytes of memory is used? If 4435968 bytes 开发者_StackOverflow社区are used without writing code, what will I be able to do with remaining 1863680 bytes?
You should consider that the background agent is a single piece of code, that's 100% separated from the rest of your application.
So when you're not testing it in a debug mode, where the application is actually running, it won't be using ~4mb of memory.
You clearly worry to much. If you're even remotely near of hitting the memory limit for a PeriodicAgent, then I strongly doubt you're doing something that's suitable for a background task.
精彩评论