Dan Pracsiu

Dan Pracsiu

  • NA
  • 1
  • 0

Memory usage of a process

Jul 3 2012 10:19 AM
I want to run a process, for example "test.exe". This process is written in C++. I would like to know how much memory is using this process: data segment (in bytes) and stack segment (also in bytes)

In tried something like this:
 
Process MyProcess = Process.Start("test.exe");
long dataSegment = MyProcess.PrivateMemorySize64;
Console.WriteLine("Memory ussage: {0} bytes",  dataSegment);

Is that code correct? How can I find out the stack segment used by the process ?