Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. heapdbg.hxx
  7. Win3 Heap Manager debug aid
  8. FILE HISTORY:
  9. DavidHov 11/22/91 Created
  10. KeithMo 21-Apr-1992 Added multi-level stack backtrace.
  11. KeithMo 12-Aug-1992 Robustified stack backtrace a bit.
  12. */
  13. #ifdef HEAPDEBUG
  14. //
  15. // This manifest constant controls the "depth" of the stack backtrace
  16. // displayed when heap residue exists after an application has
  17. // terminated.
  18. //
  19. // This value *must* be no greater than MAX_STACK_DEPTH (as
  20. // #defined in NTRTL.H (currently 16, should be plenty).
  21. //
  22. // KEEP IN MIND THAT EACH BACKTRACE LEVEL REQUIRES AN ADDITIONAL
  23. // FOUR BYTES OF STORAGE FOR *EVERY* HEAP ALLOCATION BLOCK!!
  24. //
  25. #define RESIDUE_STACK_BACKTRACE_DEPTH 4
  26. struct HEAPTAG
  27. {
  28. struct HEAPTAG * _phtRight, * _phtLeft;
  29. UINT _uSignature;
  30. PVOID _pvRetAddr[RESIDUE_STACK_BACKTRACE_DEPTH];
  31. UINT _cFrames;
  32. UINT _usSize;
  33. VOID Init()
  34. {
  35. _phtLeft = _phtRight = this;
  36. }
  37. VOID Link( HEAPTAG * phtAfter )
  38. {
  39. _phtLeft = phtAfter;
  40. _phtRight = phtAfter->_phtRight;
  41. _phtRight->_phtLeft = this;
  42. phtAfter->_phtRight = this;
  43. }
  44. VOID Unlink()
  45. {
  46. _phtRight->_phtLeft = _phtLeft;
  47. _phtLeft->_phtRight = _phtRight;
  48. Init();
  49. }
  50. };
  51. extern HEAPTAG * pHeapBase;
  52. #endif // HEAPDEBUG
  53. extern VOID HeapResidueIter( UINT cMaxResidueBlocksToDump,
  54. BOOL fBreakIfResidue );