[Lazarus] heptrc

Bernd prof7bit at googlemail.com
Wed Jun 13 14:22:36 CEST 2012

2012/6/13 Martin <lazarus at mfriebe.de>:

> But, from looking at the assembler code, it seems that it does not setup a
> stackframe as other code does. I **guess** the stuck dumpng code has a
> problem with this minimal frame.

If it omits the stackframe then something (probably the RTL) was
compiled with optimizations turned on. I can reproduce it too with
default settings but here are three simple steps how to get a complete

* build FPC (including all of RTL) with
make clean all OPT="-O- -gl"
and then install it to where it belongs in your setup, make sure
Lazarus will use it.

* put this into the "configure build Lazarus" -> "Options" field (at
the end of the line)
-O- -g1

* uncheck all optimizations in your project, check the -gl option.

Then compile your project. The very first compile will take a while
because it will now automatically also rebuild all LCL with the new
compiler and the new settings, then start your application, here is
what I get (previously I got the same output like already posted, now
I get this):

bernd at t40:~/Desktop/testus\ $ ./project1
Heap dump by heaptrc unit
1204 memory blocks allocated : 1569116/1572328
1203 memory blocks freed     : 1569100/1572312
1 unfreed memory blocks : 16
True heap size : 622592
True free heap : 625744
Should be : 622512
Call trace for block $B77AE6A0 size 16
  $0807391A  REALLOCMEM,  line 317 of
  $08099450  TFORM1__BUTTON1CLICK,  line 37 of unit1.pas
  $081F822E  TCONTROL__CLICK,  line 2734 of ./include/control.inc
  $0821E2AF  TBUTTONCONTROL__CLICK,  line 56 of ./include/buttoncontrol.inc
  $0821EA06  TCUSTOMBUTTON__CLICK,  line 175 of ./include/buttons.inc
  $0821F061  TBUTTON__CLICK,  line 355 of ./include/buttons.inc
  $0806E77D  TOBJECT__DISPATCH,  line 592 of

It seems (and this was new to me too) that -O1 is not enough to stop
it from optimizing the stack frames, it really must be -O- (I always
thought this only happens in O2 or higher but it happens in O1

More information about the Lazarus mailing list