0
Answer

Memory usage of a process

Dan Pracsiu

Dan Pracsiu

12y
948
1
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 ?