My background agent is hitting the 6MB memory limit, and I'd like to understand what objects are being allocated.
In principle I can do this using the Visual Studio Windows Phone Performance Analysis tool, however I don't see how I can run this on a background agent, only on the main app.
Anyone know how to run the Visual Studio Windows Phone Performance Analysis tool on a background agent?
Click Start, point to Programs, click Microsoft SQL Server 20xx (your version), click Performance Tools, and then click SQL Server Profiler.
You can specify a trace stop time if you use Transact-SQL stored procedures or if you use SQL Server Profiler.
If you are just trying to get the background agent to run while you are profiling you can use ScheduledActionService.LaunchForTest like in this question. And here it is noted that it can still take a while before the agent runs.
If you want to test just the background agent outside of the rest of the app I haven't seen a good way to do it. However I would make a make an empty app and have it manually run the background agent functionality. Then you can profile that and it should work well enough.
Additionally here are some links about keeping your memory consumption down in background agents that you might find helpful:
Wp7.5 Mango–Background Agents - Chris Sainty (of gReadie fame)
Optimizing memory consumption for WP7 Background Agents - Oliver Weichhold
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With