The term 'current memory usage' is a little loosely defined. Do you mean the working set? Whatever it means, you can use different properties such as VirtualMemorySize
, WorkingSet
, PrivateMemorySize
, etc. from the process class to retrieve it.
long workingSet = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…