Welcome to memory leaks tracker for Delphi 3.

This product was designed for Visual C++ - like debugging of heap allocations. Borland Delphi supplies method for such debugging. Here is a FREE realisation. You can use it in 2 modes - silent & verbose. In Verbose mode your application will run VERY slow, but you'll see each memory allocation caller's. It's not so useful, as it looks, because the most part of memory allocations are requered from SysAllocateString & TObject.NewInstance. In both modes you always can call GetUsedSize() to view allocated heap size and after executing of your programm you'll see debug dump of memory leaks.

Use of it is very simple - include MemDebug.pas to first line of your project's uses clause. You will need also to enable detailed map in project/options/linker. Compile your project. Run MS WinDbg (available for free download on http://www.microsoft.com/msdn/downloads/) and select programm/open/new/ <name of your exe>. After executing you will see string "Dumping memory leaks" and some addresses from top of stack" in form <unit name>.[<class name>].<procedure name> in command window of WinDbg.

You will need also to register atl.dll & parsemap.dll, using Regsvr32.exe(windows\system) or tregsvr.exe (delphi\bin).

Please report bugs and your references to bercut@infopro.spb.su.

Units

  1. MemDebug.pas - main unit. Uses Parsemap.pas.
    procedure SetMDebugState(aState : Boolean); - Set mode to verbose or silent.
    function GetUsedSize: Integer; - Returns size of allocated heap.
  2. Parsemap.pas - interface unit to parsemap ATL-written component. I use ATL to allocate non - pascal memory for debugging memory... Uses ComHelp(optional).
  3. ComHelp - remove it, if your system don't supports DCOM. Single routine -
    procedure EnableAuthentification95;
    really it disables any Authentification.

Don't forget to register atl.dll & parsemap.dll, using regsvr32.exe(MS) or tregsvr.exe(Borland). Or simply run setup.bat.


Copyright © Vladimir.V.Kuchinsky.