Einzelnen Beitrag anzeigen

mjustin

Registriert seit: 14. Apr 2008
3.005 Beiträge
 
Delphi 2009 Professional
 
#7

AW: FastMM Memory Leaks : Lesen und verstehen von Stacktrace

  Alt 8. Sep 2014, 13:43
O.K von unten ist ja schon mal ein sehr guter Hinweis. Ist es möglich die Anzahl der Leaks irgendwie herauszufinden? Eigentlich ist es mir (erstmal) egal wenn beim beenden des Programms ein Objekt welches beim Start erzeugt wurde nicht freigegeben wird. Schön wäre es aber nach einer gewissen Laufzeit zu sehen ob das 12Byte Leak XY 100 Mal aufgetreten ist - oder eben nur ein Mal. Ist so was möglich?
Ja, indem man den aktuellen Status des FastMM4 Speichermanagers in eine Datei schreibt und diese beobachtet.
Objekte, die leaken, erscheinen dann mit einer stetig wachsenden Anzahl in der Liste.

How do I find memory leaks at run time with FastMM4?
http://mikejustin.wordpress.com/2013...-with-fastmm4/

Strategy or tools to find “non-leak” memory usage problems in Delphi?
http://stackoverflow.com/a/17365483/80901

Step by step Anleitung:

  1. add a call to LogMemoryManagerStateToFile('memory.log', '') in a place where it will be called in intervals
  2. run the application
  3. open the log file with an editor (which auto-refreshes when the file content changes)
  4. watch the first lines of the file, they will contain the memory allocations which occupy the highest amount of memory
  5. if you see a class or memory type constantly has a growing number of instances, this can be the reason of your leak
Michael Justin

Geändert von mjustin ( 8. Sep 2014 um 13:46 Uhr)
  Mit Zitat antworten Zitat