[fpc-pascal] Leak narrowed down

Andrew Brunner andrew.t.brunner at gmail.com
Fri Oct 29 02:19:52 CEST 2010


>> Then, once the program is running and has leaked memory, run
>> leaks nameofyourprogram
>
> Thanks for this tip! It is very interesting, however in this situation
> it does not detect the lost memory.
>
> At this point I have to give up on GetTextWidth - I will avoid it for
> now. Maybe next year the problem can be solved. I will send a note to
> the Lazarus list and submit a bug report, provided I can confirm the
> issue with a minimal testing program.

There are two instances in the past that I had with working with
GetTextWidth to the point where I started with Delphi's canvas and
traced into their code and derived my own from theirs.  If you are
needing the feature then compile FPC with DEBUG=1, recompile Lazarus
with DEBUG=1 (I think), then trace into the LCL/FPC code and take a
look around.

It could be with the string it could be with the Device Context used
to draw the text and see its width.  It could be the Handle to the
font object not being de-allocated.  Do you use try handling with
finally SetLength(Str,0)?

If you place a counter inside that routine, how many times is it
called?  That may help too.



More information about the fpc-pascal mailing list