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
nie_trzeba
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
Mohammed
source
to share
If you are working with Visual Studio 2015 you can usePerformances profiler
debug
Select from the menu:
- Debug
- Profiler
- Execution profiler
- Profiler
Then select .Net memory allocation
0
BΓ©ranger
source
to share