如何在 C# .net core / .net standard 中获取可用内存或使用内存
How to get memory available or used in C# .net core / .net standard
有没有办法知道当前进程使用的内存?
我检查了很多问题:
How to get the amount of memory used by an application
How to get memory available or used in C#
它们在 .Net Standard 1.6 中不可用。
在这里您可以查看 HealthChecks project 中是如何完成的。您可以使用 System.Diagnostics
命名空间中的 Process
class。
* 编辑 *
System.Diagnostics.Process Nuget package 可能需要添加。
.NET Standard 仅支持 xxxx64 内存属性(例如 PrivateMemorySize64 而不是 PrivateMemorySize)。
有没有办法知道当前进程使用的内存?
我检查了很多问题: How to get the amount of memory used by an application
How to get memory available or used in C#
它们在 .Net Standard 1.6 中不可用。
在这里您可以查看 HealthChecks project 中是如何完成的。您可以使用 System.Diagnostics
命名空间中的 Process
class。
* 编辑 *
System.Diagnostics.Process Nuget package 可能需要添加。
.NET Standard 仅支持 xxxx64 内存属性(例如 PrivateMemorySize64 而不是 PrivateMemorySize)。