Search code examples
c#memory-dump

Taking memory dump using C#


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?


Solution

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

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