Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Windows Phone Performance tips: Monitoring the memory usage

DZone's Guide to

Windows Phone Performance tips: Monitoring the memory usage

· Mobile Zone
Free Resource

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

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.

image


Source:  http://mikaelkoskinen.net/post/wp7-performance-tip-monitoring-memory-usage.aspx

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}