[fpc-pascal] memory leak detection using FPC

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Sep 19 09:58:34 CEST 2006

On 19 sep 2006, at 09:33, Graeme Geldenhuys wrote:

> So what is wrong with this code then...  When I quit the app, it says
> I have one memory leak. What am I not freeing?

If you compile the rtl with line info, you'll see the non-freed  
object is in the RTL:

Call trace for block $00187260 size 60
   $0000E284 line 180 of /Users/jonas/fpc/rtl/inc/objpas.inc
   $0000F070 line 724 of /Users/jonas/fpc/rtl/inc/objpas.inc
   $00052158 line 16 of /Users/jonas/fpc/rtl/objpas/sysutils/ 
   $00039F0C line 1658 of /Users/jonas/fpc/rtl/objpas/classes/ 

Line 1658 of classes.inc is

   GlobalNameSpace := TMultiReadExclusiveWriteSynchronizer.Create;

in the procedure CommonInit. In CommonCleanup it does:

   { GlobalNameSpace is an interface so this is enough }

but apparently this is either not enough, or there is a bug with  
interface reference counting (the latter is possible, since I've read  
more things about that lately).


More information about the fpc-pascal mailing list