加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

内存管理 – 如何在UWP App运行时查看(近似)内存使用情况

发布时间:2020-12-14 01:44:01 所属栏目:Windows 来源:网络整理
导读:根据 Diagnosing memory issues with the new Memory Usage Tool in Visual Studio的这篇文章: 1. Memory caps on Phone devices : In particular for Phone,there are specific memory limits enforced on an application based on the size of the memory
根据 Diagnosing memory issues with the new Memory Usage Tool in Visual Studio的这篇文章:

1. Memory caps on Phone devices: In particular for Phone,there are specific memory limits enforced on an application based on the size of
the memory in the device. Allocating more than the specified limit
will cause an OutOfMemoryException and will result in app termination.

一切顺利,在Visual Studio中,您可以使用诊断工具查看开发期间的内存使用情况.

有没有办法在(Windows 10)手机上运行的UWP应用程序可以大致了解它消耗了多少内存? – 即.在应用程序内,而不是通过利用visual studio.

更新 – 我如何选择’答案’

关键在于,这暴露了我对于一般内存的大量缺乏理解,特别是现代.net应用程序如何消耗它.这两个答案都对我有所帮助,尽管我已经对其进行了简单的实验,但很难说其中任何一个都是正确的答案,因为我发现它们都很有用.

此外,虽然我很欣赏链接到相应官方文档的答案,但这些信息非常薄(不要对Romasz& Alexej不尊重).

最后我将答案授予了Romasz,因为API看起来更深一些.

我想你也可以利用 MemoryManager课程.在那里,您可以订阅有关内存增加/减少,设置限制以及 as check memory usage of app或读取报告 for app或 for process的事件:
var appMemory = MemoryManager.AppMemoryUsage;
var appMemoryReport = MemoryManager.GetAppMemoryReport();
var processMemoryReport = MemoryManager.GetProcessMemoryReport();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读