How can I get my process's RAM usage the same as in Task Manager?

I am making a program in C # and one of my tasks is writing to a log file using the RAM of my program's process. I used WorkingSet64

as someone advised me, but it shows a very different value from what is in the task manager. How can I get the exact value displayed in the Task Manager?

+3


source to share


2 answers


Getting a process

Process proc = Process.GetCurrentProcess();

      

To get the use of private memory.



proc.PrivateMemorySize64;

      

This link might be helpful

+4


source


If you are working with Visual Studio 2015 you can usePerformances profiler

debug

Select from the menu:

  • Debug
    • Profiler
      • Execution profiler


Then select .Net memory allocation

enter image description here

0


source







All Articles