Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Memory Dump of a Process in Windows Server 2003?

Since windows Vista, we have the nice option to create a memory dump of a process directly from Task Manager. Sadly, Windows Server 2003 does not have this option yet :( I found ways to do a complete system-wide memory dump, but that's a bit too much.

Is there a way to dump a single process? As this is a production Server, I do not want to install any heavy-weight tools or and service that runs in the background, ideally I'd just like to dump the process, copy the dump to my own machine and debug it there.

like image 571
Michael Stum Avatar asked Jan 22 '10 19:01

Michael Stum


People also ask

How do I create a memory dump in Windows?

Enable memory dump settingIn Control Panel, select System and Security > System. Select Advanced system settings, and then select the Advanced tab. In the Startup and Recovery area, select Settings. Make sure that Kernel memory dump or Complete memory dump is selected under Writing Debugging Information.

What is memory dump in Windows Server?

A complete memory dump records all the contents of system memory when your computer stops unexpectedly. A complete memory dump may contain data from processes that were running when the memory dump was collected.


3 Answers

You can attach the Windows debugger (ntsd or windbg) to the proccess, then when you want to create a dump of the process you can use the .dump command:

0:000> .dump /ma myprocess-crash.dmp
Creating myprocess-crash.dmp - mini user dump
Dump successfully written
0:000>
like image 114
i_am_jorf Avatar answered Sep 20 '22 22:09

i_am_jorf


Yes, look for userdump.exe. See this KB article.

like image 29
Ana Betts Avatar answered Sep 21 '22 22:09

Ana Betts


I think this 'answer' should be a comment under jeffamaphone's answer but I do not have enough reputation to comment.

Windows Server 2003 ships with ntsd so there is no need to install anything. Get the Process ID of the process and attach ntsd to the process:

C:> ntsd -p 4356

Then use ntsd to dump the process:

.dump /f c:\MyDumpFiles\foo.dmp
like image 27
Mike Avatar answered Sep 18 '22 22:09

Mike