[SOLVED]Heaptrc output and meaning lazarus / 12-Debugger ---------------------------------------------------------------------- IndianaJones · 2011-10-24 19:06 Hi all, How can I interpret unfreed memory blocks? Thanks. ---------------------------------------------------------------------- ik · 2011-10-24 20:44 If I understand you correctly, it show you the last known place you did something with memory (using getmem/new or other commands like that), so you can  try and track it and understand why it is not freed and fix it. ---------------------------------------------------------------------- Martin_fr · 2011-10-24 21:46 First of all forget about the line that says "true free heap": It is build on some internals, and you will not need it. You should look at "xxx unfreed blocks" or similar. If it is zero, then you are good. Otherwise it tells you how much memory you lost in how many blocks of allocation. E.g if you created an object, but never destroyed it. For each of them you get a location where the memory was allocated. There is a package "LeakView" which you can install. It takes the output and helps you browse the files in the IDE. It is still tricky to find what is going on. If you leaked a TStringList, that did hold 10 strings, then you did also leak those 10 strings. Yet looking at the code that assigns the string, does not help you closing the leak. In cases like this, you have to find out about the encapsulating object (The stringlist). But that may again have been hold by another object, that did never get destroyed (but would on destruction have released the list...)... And so on. ---------------------------------------------------------------------- IndianaJones · 2011-10-25 08:34 Thanks for the information, but how can I use the "LeakView", what is the procedure? ---------------------------------------------------------------------- Martin_fr · 2011-10-25 09:00 LeakView is a package. It is in the directory components/leakview Either open the package, and install it from the package window. Or open the "Install/Uninstall packages" and select it there and install. Once installed, there is a menu entry in the "Tools" menu. Then copy the stacktrace Code: [Select]Call trace for block $B1E75B70 size 36 $0833C15C TFINDDECLARATIONTOOL__CHECKSRCIDENTIFIER, line 8332 of finddeclarationtool.pas $0833C55B TFINDDECLARATIONTOOL__DOONIDENTIFIERFOUND, line 8512 of finddeclarationtool.pas $08330835 CHECKRESULT, line 2681 of finddeclarationtool.pas and paste it. Or if it is in a logfile, open the file. It will display all the lines, and you can double click them ---------------------------------------------------------------------- IndianaJones · 2011-10-25 09:19 Thanks Martin, But There is a problem with Windows7, when adding the "LeakView" package, it doesnt appear under the Tools menu. It works for GTK2 and Mac Snow Leopard. ---------------------------------------------------------------------- Martin_fr · 2011-10-25 09:40 If that is the case, then please bug report it. It works on Win Vista, but I haven't got W7