English 中文(简体)
如何用 Wp7.1 背景代理描述内存使用情况?
原标题:How can I profile the memory usage in a wp7.1 background agent?

我正在为芒果(7.1)的预定背景代理工作。

我设法利用基于Device Status.ApplicationPeakMemoryUsage 的人工追踪技术,将我的记忆用量从10.5MB降至6.5MB, 并使用一些关于优化的智能猜测。

然而,现在我需要降到6MB以下, 而最后的0.5MB已经证明是难以实现的。

我设法在主要应用程序上运行了“Windows电话性能分析 ”, 但似乎无法找到一个方法来对抗代理商。

是否有任何工具和/或技术可以帮助我确定什么是填充我代理记忆的工具和/或技术? 理想的情况是,我想用一种方法来调查整个记忆空间――包括代码和数据,理想的情况是,它应该与释放结构相对应。

最佳回答

正如已经说过的,调试器将增加一个不可忽略的内存间接费用。

  • 激活模拟器控制台: < a href=" http://nicksnettravels. buildtoroam.com/post/2011/01/19/ Windows-Phone-7-Console- Window-on- 64-bit- Meach.aspx" rel=“ noreferrer” > http://nicksnettravels.cruiltoroam.com/post/2011/01/19/ Windows-Phone-7-Console-Window-on64-bit-micher.aspx

  • 在您的代码的战略点(例如主要函数的起始和结束,或者在分配大对象之后)显示内存消耗量:

    Console.WriteLine("Function {0}: {1}", "name of your function", DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage"));
    
  • 启动应用程序时不附加调试器( Ctrl + F5),请坐并享受

问题回答

记住, 如果您在调试模式下运行背景代理, 这将给该代理的记忆足迹增加大约 2MB, 所以您可能没事 。

您可能会使用“ 应用程序PeakMemoryUsage ”, 直接运行应用程序时, 而不是从视觉工作室直接将内存细节写入孤立存储处的文件 。

- 鲁珀特。





相关问题
System.Json namespace missing from Windows Phone 7

During a Mix10 presentation, the presenter (Charlie Kindel) said that when writing Silverlight based apps for WP7 you get all of Silverlight 3.0 with some of Silverlight 4.0 mixed in. Why then is ...

Will Windows Phone 7 Support Multitasking third party apps

Obviously it s early days, I do not know whether this is information that is in the public domain or not yet, but... I have trawled through some of this site - http://www.windowsphone7series.com/ but ...

Windows Series Phone 7 "Cloud"

I have been reading up on "Cloud computing" on here and still not getting it. Basically I want to develop for the WP7 http://msdn.microsoft.com/en-us/library/ff402531%28v=VS.92%29.aspx#...

Windows Phone 7 Tab Pages (page cycle)

I know.. I know, it s only a few hours old. But how the hell do you get the little page tabbing/cycle (forgot what the official name is) on the top of the page under the app title. MIX Keynotes made ...

Recording audio from the microphone in Windows Phone 7 Series

I m wondering if anyone has any code samples or links to documentation that demonstrate how to capture audio from the device s microphone on the new Windows Phone Series 7. I ve recently downloaded ...

Resources for Windows Phone 7 development [closed]

Windows Phone 7 has been unveiled and MS have announced all details of the development chain at the Mix10 conference. So this could be a good starting point/collection of online resources as they ...

热门标签