Windows Phone Performance tips: Monitoring the memory usage
The default Windows Phone emulator offers plenty of ways to monitor your application's performance, but in this quick tip you'll learn how to monitor the total
memory usage of your application when your emulator can't.
Out of the box the WP7 emulator offers a way to monitor some
performance aspects of a WP7 app by providing the following counters:
- Render thread FPS
- User interface FPS
- Texture memory usage
- Surface counter
- Intermediate texture count
- Screen fill rate
The counters are turned on by default and can be manually turned off by removing the following line in App.xaml.cs (or by changing the flag to false):
1: Application.Current.Host.Settings.EnableFrameRateCounter = true;
Jeff Wilcox has a great article about the different performance counters and it can be reached from his blog.
What is missing from the emulator is a way to monitor the total memory usage of your application. WP7 app shouldn’t use more than 90MBs of RAM so monitoring the mem usage is crucial. Thankfully, Peter Torr comes to the rescue. He has published a class called MemoryDiagnosticsHelper which adds a total memory usage counter to the application. It’s really easy to use and it blends nicely with the built-in performance counters.
To use the MemoryDiagnosticsHelper, first download it from the Peter’s site. Add the class into your project and then add the following line in your App.xaml.cs, just after the line where the EnableFrameRateCounter is set:
1: MemoryDiagnosticsHelper.Start(true);
And that’s all that is required. Now you can start your application and see the total memory usage.
Source: http://mikaelkoskinen.net/post/wp7-performance-tip-monitoring-memory-usage.aspx
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Schlacter Adam replied on Sat, 2012/04/14 - 1:11am
The memory tool does not appear for us in the line of debug text. We have followed your instructions, and it simply does not appear on screen. I have also found others having this same problem.