Taking memory dump using C#

Kenn picture Kenn · May 4, 2011 · Viewed 15.2k times · Source

I've got a System.Diagnostics.Process object. My C# program is monitoring it for some condition. When the condition is hit, I want to take a full memory dump of the Process.

What is the best way to achieve this?

Is there a way that is provided by the CLR?

Answer

user703016 picture user703016 · May 4, 2011

You could use ProcDump from Sysinternals and make your C# program call it when needed.

Process.Start("procdump " + otherProgramPID.ToString());