在调试Windows Phone程序的时候,我们通常需要知道当前程序占用的内存是多少,有没有发生内存泄露。
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
}
以下是右侧工具条的具体解释
<a href="http://blog.51cto.com/attachment/201105/101249114.png" target="_blank"></a>
属性值
返回值
描述
DeviceTotalMemory
long integer
设备总内存(单位字节)
ApplicationCurrentMemoryUsage
当前应用程序内存使用量(单位字节)
ApplicationPeakMemoryUsage
当前应用程序最高使用量(单位字节)
可能你需要写如下的代码来查看这些数据
<a href="http://blog.51cto.com/attachment/201105/101317442.png" target="_blank"></a>
dnp.Counter.EnableMemoryCounter = true;
默认是2秒刷新一次,当然你可以自己设定刷新间隔
dnp.Counter.SetTimerInterval(1);
<a target="_blank" href="http://blog.51cto.com/attachment/201105/2621421_1306463501.rar"></a>
参考
<a href="http://down.51cto.com/data/2358250" target="_blank">附件:http://down.51cto.com/data/2358250</a>
本文转自xshf12345 51CTO博客,原文链接:http://blog.51cto.com/alexis/575367,如需转载请自行联系原作者