On 3 April 2010 21:01, Werner Van Belle <wer...@yellowcouch.org> wrote: > > Type > TReferenceCount = Class
That is the same as... TReferenceCount = class(TObject) > var > Test : TReferenceCount; > Pest : TReferenceCount; > begin > Test:=TReferenceCount.Create(); ...snip... > Test:=nil; This causes a memory leak - you did not actually free the class instance. You need to call: Test.Free; > Pest:=nil; Pest was just a reference pointer to the first instance, so no need to free it. But setting it to nil after Test was freed is a good habit. If you wanted real reference counted objects that gets freed automatically when nothing is referencing it, then create a descendant of TInterfacedObject. -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal