Windows Phone monitors memory usage

Source: Internet
Author: User

Debug Windows PhoneProgramWe usually need to know how much memory is occupied by the current program and whether there is any memory leakage.

In the previous Windows Phone 7 tips (5), we mentioned that enableframeratecounter is used to monitor the frame rate when the program is running. The usage is as follows:

// Show graphics profiling information while debugging. if (system. diagnostics. debugger. isattached) {// display the current frame rate counters. application. current. host. settings. enableframeratecounter = true;

}

The following is a detailed explanation of the toolbar on the right.

 

There is no memory usage we want to see here. How can we do this. There is such a class in Windows Phone Microsoft. Phone. info. deviceextendedproperties The memory usage is provided. The specific attributes are as follows:

Attribute Value Return Value Description
Devicetotalmemory Long Integer Total device memory (in bytes)
Applicationcurrentmemoryusage Long Integer Current application memory usage (in bytes)
Applicationpeakmemoryusage Long Integer Maximum Application Usage (in bytes)

You may need to write the followingCodeTo view the data

 

Of course, there is also a simpler method, that is, to introduce a DLL (DLL download), and then write a few pieces of code to complete the process.

 DNP.Counter. Enablememorycounter =True;

The default refresh interval is 2 seconds. Of course, you can set the refresh interval by yourself.

 DNP.Counter. Settimerinterval (1 );

 

Reference

Http://blogs.msdn.com/ B /mikeormond/archive/2010/12/16/monitoring-memory-usage-on-windows-phone-7.aspx

Http://dotnetprofessional.com/blog/post/2010/09/27/Debug-Memory-Counter-for-Windows-Phone-7.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.