[fpc-devel] type discussion

Hans-Peter Diettrich DrDiettrich at compuserve.de
Sat Jun 4 08:53:20 CEST 2005

Jamie McCracken wrote:

> > Garbage collection is largely no issue when using the Owner concept in TComponent, using TObjectList, etc.
> True and thats why I suggested ref counting Tobjects only so that no
> manual memory management is required. I tend to make heavy use of TList,
> Tstringlist and TFilestream objects so I cant do everything with
> tcomponents alas.

What do you mean with "Tobjects"? Isn't TObject the ancestor of all

If you mean a dedicated root class for reference counted objects, you
can use interface instead of class variables (at least in Delphi, not
sure about FPC).

As was already pointed out, GC doesn't work well without assistance in
actual code. There's no big difference between setting a reference to
Nil, and calling the destructor or FreeAndNil, for the same purpose.

Auto-destroyed local objects, or local interface references, require
hidden try-finally blocks; from similar discussions I know that many
people don't like such invisible magics, for performance and
othX-Mozilla-Status: 0009

More information about the fpc-devel mailing list