[Lazarus] Memory leak hunt request

waldo kitty wkitty42 at windstream.net
Sun Apr 27 01:46:45 CEST 2014

On 4/26/2014 6:08 AM, Graeme Geldenhuys wrote:
> On 2014-04-26 10:31, Reinier Olislagers wrote:
>> I'm often a bit dumb when it comes to memory management/memory leaks -
>> probably because of my managed code experience (yes, excuses, excuses)...
> From my experience, develop your software from the ground up with
> Heaptrc unit enabled (compiler option -gh). It is MUCH easier to fix a
> memory leak the second you created it, compared to 6 months down the line.

+1~~~~~ can't emphasize this enough... too many times things are developed 
without stack, heap and/or pointer tracking which comes back to haunt later when 
they are disabled for release compilations...

> As for your question about how to resolve them. Simply enable -gh, run
> your app from a console window. Start simple. eg: Run the app, then
> immediately exit. Do memory leaks occur? If so, analyse the heaptrc
> output. Trace the line numbers and call stack. Go through the affected
> code with a fine tooth comb. Fix and repeat the test. Did the leak count
> reduce.
> Once all "application startup" leaks have been fixed, move to another
> dialog, and repeat the whole process. Yes, it's painful and boring as
> hell. Hence my suggestion on starting development with -gh enabled and
> it makes it much easier.

you've got this nailed ;)

NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.

More information about the Lazarus mailing list