Page Heap and Pagalloc


In general, pagalloc is primarily useful for tracking down MicroStation Element Descriptor related memory issues.  For all other cases you can use standard Microsoft memory diagnostics tools and workflows to troubleshoot and validate memory usage patterns.  Two common workflows to troubleshoot heap corruption specifically are.

  1. Use Microsoft Debug Diagnostics Tool (DebugDiag) to configure and capture 32-bit and 64-bit user mode application memory dumps and perform hang/performance (series), and crash/exception analysis.  The Advanced tab provides options to configure page heap without need to download the Windows 10 SDK (used for prior operating systems too) to get gflags.exe and/or learn which specific registry keys and values to set (without using gflags).  Though an older document this article provides a solid overview on how to leverage DebugDiag for a number of use cases: How to Use the Debug Diagnostic Tool v1.1 (DebugDiag) to Debug User Mode Processes.  More information can be found on the DebugDiag Blog.

  2. Use Page Heap and GFlags to make issues "reproducible". Start by enabling full heap protection (e.g. gflags -p /enable microstation.exe /full /protect), reproduce the issue either; a.) perform a live debug session, or b.) save off full memory dump and perform offline crash analysis, patch any bugs found, then make sure to disable page heap (e.g. gflags -p /disable microstation.exe) to return application memory management and performance.

Either approach should allow you to accurately identify an exact call stack related to the heap corruption as long as all your source code projects produce Microsoft pdb files matching their binaries (libraries and exes).

See also: Debugging with Symbols, PageHeap vs PagallocWhat is Pagalloc.