[fpc-pascal] Destroy vs Free: Memory Leak?
Michael Van Canneyt
michael at freepascal.org
Tue Sep 7 09:52:09 CEST 2010
On Mon, 6 Sep 2010, Brian Winfrey wrote:
> I have a TestCase that has this issue. If I call obj.Free, I am
> unable to step into the Destroy method and heaptrc indicates a memory
> leak. If I call obj.Destroy everything works as expected. Following
> the call to Free -
> ... if (obj <> nil) then obj.Destroy;
> it would seem that the object must be nil. How can I test this? i am
> unable to step into objpas?.inc.
You don't need to step in ?
Replace the line Obj.Free with
if (Obj=nil) then
Writeln('Error')
else
Obj.Free;
Then you'll find the error.
To do what you want you'll need to recompiler everything (RTL, FCL, PAckages
etc. with debug information (pass OPT=-gl to the make command line, maybe
DEBUG=1 also works)
Michael.
More information about the fpc-pascal
mailing list