nie_trzeba
nie_trzeba

Reputation: 51

How can i get the RAM usage of my process just like in Task Manager?

I'm making a program on C# language, and one of my task it's write to the log file used RAM of the process of my program. I used WorkingSet64 as someone advised me, but it showing so very different value from what is at the Task Manager. How can i get the exact value as it showing in Task Manager ?

Upvotes: 3

Views: 1151

Answers (2)

Béranger
Béranger

Reputation: 673

If you work on Visual Studio 2015, you can use the Performances profiler

In the debug menu select:

  • Debug
    • Profiler
      • Performances Profiler

Then select .Net memory allocation

enter image description here

Upvotes: 0

Mohammed
Mohammed

Reputation: 426

Getting the process

Process proc = Process.GetCurrentProcess();

To get the private memory usage.

proc.PrivateMemorySize64;

This link might be helpful

Upvotes: 4

Related Questions