1

My program creates a minidump on crash (using MiniDumpWriteDump from DBGHELP.DLL) and I would like to keep the size of the dump as low as possible while still having important memory information available. I have gone through the different possible combinations of flags and callback functionalities you can pass to MiniDumpWriteDump (links to debuginfo.com or MSDN).

I think I am limited to these MINIDUMP_TYPE flags, since it has to work on an old WinXP machine:

  • MiniDumpNormal
  • MiniDumpWithDataSegs
  • MiniDumpWithFullMemory
  • MiniDumpWithHandleData
  • MiniDumpFilterMemory
  • MiniDumpScanMemory

I am searching for a way how to combine these flags and the callback function to get a dump with the following requirements:

  • Relative small size (Full memory dump results in ~200MB filesize, I want max. 20MB)
  • Stack trace of the crashed thread, maybe also the stack trace of other threads but without memory info
  • Memory information of the whole stack of the crashed thread. This is where it gets complicated: Including stack memory should be no problem in terms of size but heap memory might be overkill.

The question is how can I limit the memory info to the crashed thread and how to include stack memory (local variables) of the whole call stack? Is it also possible to include parts of the heap memory, like only these parts that are referenced by the current call stack?

bender
  • 613
  • 1
  • 8
  • 23
  • The heuristics that MiniDumpCreateDump() uses to minimize the minidump are not documented. But you do always get the thread stack in the minidump. And it does try to find pointers into the heap and includes parts of the heap that are referenced by such a pointer. Which usually produces a decent minidump that's still small. Somewhat inevitably, sooner or later you'll have a case where the process is so heavily corrupted that you won't get a good dump, only including everything is going to give you a shot to see how the bomb went off. You can't have it both ways, make it a config setting. – Hans Passant Jun 11 '15 at 09:22
  • Remove `MiniDumpWithFullMemory`. It will even give you up to 4 GB dumps if your application uses that much memory – Thomas Weller Aug 28 '15 at 22:05
  • Closest to your requirement would be `MiniDumpWithIndirectlyReferencedMemory` but that's not available on XP, is it? – Thomas Weller Aug 28 '15 at 22:08

0 Answers0