问题
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