Lazarus

Using the Lazarus IDE => Debugger => Topic started by: ricardo.consolo on March 01, 2017, 01:51:11 pm

Title: Heap dump by heaptrc unit on Windows
Post by: ricardo.consolo on March 01, 2017, 01:51:11 pm
Hi.

When in debug mode (Windows 7 32 bits), I got this message when closing the application:

---------------------------
Error
---------------------------
Heap dump by heaptrc unit
9426 memory blocks allocated : 2495279/2522280
9426 memory blocks freed     : 2495279/2522280
0 unfreed memory blocks : 0
True heap size : 294912
True free heap : 294832
Should be : 294912

---------------------------
OK   
---------------------------

The same application does not show that on Linux (Centos 6 32 bits).

Any clue?

Thanks.
Title: Re: Heap dump by heaptrc unit on Windows
Post by: howardpc on March 01, 2017, 02:15:10 pm
Perhaps on Linux the heaptrc output is being sent to a nonexistent or hidden window, or maybe your Linux compilation setup is not set to generate heaptrc output at all.
Title: Re: Heap dump by heaptrc unit on Windows
Post by: Ondrej Pokorny on March 01, 2017, 02:57:30 pm
Linux sends it to the standard output.
Title: Re: Heap dump by heaptrc unit on Windows
Post by: avra on March 01, 2017, 03:33:23 pm
Have you tried to uncheck "Use Heaptrc unit" in Project options / compiler options / debugging ?
Title: Re: Heap dump by heaptrc unit on Windows
Post by: Thaddy on March 01, 2017, 04:52:57 pm
And fortunately heaptrc also reports there's not much wrong with your code?  O:-) That memory will be free'd.
If you want to use the heaptrc unit and keep it (only with -gh,not as an include in the uses clause)  there's also the option to compile with UseHeapTrace:= False.
Which skips the report.

But make sure that you did not add heaptrc to a uses clause anywhere yourself!. See the recent wiki.
http://wiki.freepascal.org/heaptrc

Avra's pointer is correct by the way: that selects or un-selects -gh for you.
Title: Re: Heap dump by heaptrc unit on Windows
Post by: ricardo.consolo on March 01, 2017, 10:05:55 pm
Thanks for the info.

I have checked them all and got it working.

FYK, Linux output happens only when running the app from the terminal.

Also, there was a bad destroy method in my code that I fixed.

Thanks.
Title: Re: Heap dump by heaptrc unit on Windows
Post by: michaelthuma on November 17, 2017, 03:52:17 pm
View-Debug Windows - Console Output


Thanks for the info.

I have checked them all and got it working.

FYK, Linux output happens only when running the app from the terminal.

Also, there was a bad destroy method in my code that I fixed.

Thanks.
TinyPortal © 2005-2018