memory-management - 如何在 UWP 应用程序运行时查看(近似)内存使用情况

标签 memory-management uwp windows-10-mobile

根据 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 应用程序是否可以大致了解它消耗了多少内存? - IE。在应用程序中,而不是通过利用 Visual Studio。

更新 - 我如何选择“答案”

关键是这暴露了我对内存的普遍缺乏了解,特别是现代 .net 应用程序如何使用它。这两个答案对我都有帮助,即使我对这两个答案进行了简短的试验,也很难说其中任何一个是正确的答案,因为我发现它们都很有用。

此外,虽然我很欣赏链接到适当官方文档的两个答案,但这些信息非常少(没有不尊重 Romasz 和 Alexej)。

最后,我将答案授予 Romasz,因为 API 似乎更深一些。

最佳答案

我想你也可以利用 MemoryManager类(class)。您可以在那里订阅有关内存增加/减少、设置限制以及 as check memory usage of app 的事件。或阅读报告for appfor process :

var appMemory = MemoryManager.AppMemoryUsage;
var appMemoryReport = MemoryManager.GetAppMemoryReport();
var processMemoryReport = MemoryManager.GetProcessMemoryReport();

关于memory-management - 如何在 UWP 应用程序运行时查看(近似)内存使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37850354/

相关文章:

c++ - C++ 中的 operator new、new_handler 函数

C memcpy 导致段错误

c# - UWP MapControl MapPolygon 描边设置不正确

c# - WP8.1和WP10的区别

c - 通过在未初始化的数据段 (bss) 中打印 "garbage values",我们可以映射出先前程序中的所有值

c++ - new char[n] 和 new (char[n]) 的区别

c# - UWP 中的 ListView

button - 动态按钮图标 Windows 应用程序

c# - Windows 10 平板电脑上的 Windows Phone 8.1 Silverlight 应用程序

c# - ExpanderView 在页面导航后展开