Take the 2-minute tour ×

I'm working on a scheduled background agent for Mango (7.1)

I've managed to cut my memory usage down from 10.5MB to 6.5MB using manual trace techniques based on DeviceStatus.ApplicationPeakMemoryUsage along with some intelligent guesswork about what to optimise.

However, now I need to get down to below 6MB - and the final 0.5MB is proving elusive.

I've managed to run the "Windows Phone Performance Analysis" tool on the main app, but can't seem to find a way to get it to run against the agent.

Are there any tools and/or techniques available to assist me in working out what is filling up my agent's memory? Ideally I'd like a way to investigate the entire memory space - including both code and data, and ideally it should work against a release build.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

As has already been said, the debugger will add a non-negligible memory overhead. So the best way I found is:

share|improve this answer
Thanks - +1 for that console link! –  Stuart May 24 '12 at 12:03

Remember if you are running the background agent in Debug mode this adds about 2MB onto the memory footprint of the agent, so you might be OK.

You could probably use the ApplicationPeakMemoryUsage still and write the memory details out to a file in Isolated Storage when running the app directly, rather than from Visual Studio.

HTH - Rupert.

share|improve this answer
Thanks Rupert - do you have any reference for that 2MB additional memory use. I've tried running the release code and I don't believe I've seen a memory drop (indeed I may have seen a small memory increase!) –  Stuart May 24 '12 at 10:33
I found the details here - forums.create.msdn.com/forums/p/90642/542875.aspx - the comment actually says 1.5MB rather than 2MB. –  Rupert May 24 '12 at 10:39
Thanks - +1 for the suggestion –  Stuart May 24 '12 at 12:24

You may find the following blog post interesting, you may have already seen it but it describes both the debug memory addition as well as some tips to decrease the memory footprint.


share|improve this answer

Your Answer


