FastMMDebugSupport.pas 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {
  2. Fast Memory Manager: FullDebugMode Borlndmm.dll support unit
  3. If you use the replacement Borlndmm.dll compiled in FullDebugMode, and you need
  4. access to some of the extended functionality that is not imported by
  5. sharemem.pas, then you may use this unit to get access to it. Please note that
  6. you will still need to add sharemem.pas as the first unit in the "uses"
  7. section of the .dpr, and the FastMM_FullDebugMode.dll must be available on the
  8. path. Also, the borlndmm.dll that you will be using *must* be compiled using
  9. FullDebugMode.}
  10. unit FastMMDebugSupport;
  11. interface
  12. {Specify the full path and name for the filename to be used for logging memory
  13. errors, etc. If ALogFileName is nil or points to an empty string it will
  14. revert to the default log file name.}
  15. procedure SetMMLogFileName(ALogFileName: PAnsiChar = nil);
  16. {Returns the current "allocation group". Whenever a GetMem request is serviced
  17. in FullDebugMode, the current "allocation group" is stored in the block header.
  18. This may help with debugging. Note that if a block is subsequently reallocated
  19. that it keeps its original "allocation group" and "allocation number" (all
  20. allocations are also numbered sequentially).}
  21. function GetCurrentAllocationGroup: Cardinal;
  22. {Allocation groups work in a stack like fashion. Group numbers are pushed onto
  23. and popped off the stack. Note that the stack size is limited, so every push
  24. should have a matching pop.}
  25. procedure PushAllocationGroup(ANewCurrentAllocationGroup: Cardinal);
  26. procedure PopAllocationGroup;
  27. {Logs detail about currently allocated memory blocks for the specified range of
  28. allocation groups. if ALastAllocationGroupToLog is less than
  29. AFirstAllocationGroupToLog or it is zero, then all allocation groups are
  30. logged. This routine also checks the memory pool for consistency at the same
  31. time.}
  32. procedure LogAllocatedBlocksToFile(AFirstAllocationGroupToLog, ALastAllocationGroupToLog: Cardinal);
  33. implementation
  34. const
  35. borlndmm = 'borlndmm.dll';
  36. procedure SetMMLogFileName; external borlndmm;
  37. function GetCurrentAllocationGroup; external borlndmm;
  38. procedure PushAllocationGroup; external borlndmm;
  39. procedure PopAllocationGroup; external borlndmm;
  40. procedure LogAllocatedBlocksToFile; external borlndmm;
  41. end.