Free Pascal ha una funzione simile. Alla fine del programma, chiamare DumpHeap
o abilitare l'opzione heaptrc nelle impostazioni del progetto Lazarus. Il file di output può essere impostato con il metodo SetHeapTraceOutput
. Entrambi i metodi si trovano nell'unità heaptrc
che deve essere la prima nel progetto (per acquisire le allocazioni dall'inizio).
Maggiori informazioni:
visualizzazione Leak: il pacchetto di Lazzaro "LeakView" presenta il contenuto di un file di output mucchio di traccia in una vista ad albero . È incluso nell'installazione predefinita e disponibile dopo una ricostruzione dell'IDE. (Non ancora testato da me)
// By default information is written to standard output,
// this function allows you to redirect the information to a file
SetHeapTraceOutput('heaptrace.log');
// normally the heap dump will be written automatically at the end,
// but can also be written on demand any time
DumpHeap;
L'output è simile:
C:\path\to\Demo.exe
Heap dump by heaptrc unit
244 memory blocks allocated : 8305/9080
241 memory blocks freed : 8237/9000
3 unfreed memory blocks : 68
True heap size : 458752
True free heap : 458288
Should be : 458480
Call trace for block $0010CE58 size 28
$0044ACCB TIDTHREADSAFE__CREATE, line 226 of C:/path/to/indy-10.5.8.tiburon/Lib/Core/IdThreadSafe.pas
$00444245 IDTHREAD_init, line 641 of C:/path/to/indy-10.5.8.tiburon/Lib/Core/IdThread.pas
$00409D74
$0040E1A1
...
(testato con Free Pascal 2.6.0)
È in corso uno sforzo per trasferire FastMM4 in FPC. Forse potresti essere una parte. Quindi potresti eseguire il tuo codice non modificato se FastMM4/FPC sarebbe stabile. http://lists.freepascal.org/lists/fpc-pascal/2005-December/009721.html http://lists.freepascal.org/lists/fpc-pascal/2009-June/021448.html –