Forum > Beginners
Using heaptrc and lineinfo
VKB:
Hello, All.
I need get information about exact place of memory leak.
I create new simple console program
--- Code: ---program heap;
var
a, b: pointer;
begin
getmem(a,100);
getmem(b,200);
freemem(b);
//freemem(a);
end.
--- End code ---
I have Lasarus 1.2.0 win32 with default setting. I check "-gh" in project parameters ("-gl" already was checked), "-Xs" and "-Xg" I do not touch (both is disabled by default). The Lasarus creates heap.exe with size 86817 bytes.
The heap.exe writes
--- Code: --- Heap dump by heaptrc unit
2 memory blocks allocated : 300/304
1 memory blocks freed : 200/200
1 unfreed memory blocks : 100
True heap size : 131072 (128 used in System startup)
True free heap : 130768
Should be : 130776
Call trace for block $00096348 size 100
$00407DC1
$554C4C41
$53524553
$464F5250
$3D454C49
$445C3A43
$6D75636F
$73746E65
--- End code ---
I asked in russian forum http://freepascal.ru/forum/viewtopic.php?p=81397#p81397, but did not get answer.
Can anybody explain how can I get worked example, which output module and line numbers where memory leak happens?
taazz:
use the leakview package http://wiki.freepascal.org/leakview
howardpc:
I presume for programs such as yours that use only system routines, that you will need to rebuild the RTL to include debug information. The fpc RTL that is installed by default with Lazarus does not include any RTL debug information (it would make the download much bigger, compilation slower, and most do not need or want it).
You also need to turn off optimizations and smart linking in the compilation options (but I expect you know that).
VKB:
2 taazz
Leakview is not a package. Lieakview is a tool. It only can interpret output of heapdump. If heapdump is not output the line information then leakview could not show it.
2 howardpc
Yes, I turn off optimization and do not use smart linking (leave unchecked -CX and -XX). How can I recompile RTL with debug info?
howardpc:
See, for instance, this thread
http://forum.lazarus.freepascal.org/index.php/topic,24319.0.html
Navigation
[0] Message Index
[#] Next page