Forum > Beginners

Using heaptrc and lineinfo

(1/2) > >>

Hello, All.

I need get information about exact place of memory leak.

I create new simple console program
--- Code: ---program heap;

  a, b: pointer;

--- 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
--- End code ---
I asked in russian forum, but did not get answer.

Can anybody explain how can I get worked example, which output module and line numbers where memory leak happens?

use the leakview package

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).

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?

See, for instance, this thread,24319.0.html


[0] Message Index

[#] Next page

Go to full version