How to get memory available or used in C# .net core / .net standard

故事扮演 提交于 2020-01-13 09:56:39

问题


Is there a way to know the current used memory in the current process?

I checked many questions: How to get the amount of memory used by an application

How to get memory available or used in C#

They are not available in .Net Standard 1.6.


回答1:


Here you can check how it is done in HealthChecks project. You can use Process class from System.Diagnostics namespace.

* EDIT *

System.Diagnostics.Process Nuget package might need to be added.

Only xxxx64 memory properties are supported in .NET Standard (for example PrivateMemorySize64 and not PrivateMemorySize).



来源:https://stackoverflow.com/questions/45268472/how-to-get-memory-available-or-used-in-c-sharp-net-core-net-standard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!