[fpc-devel] Suggestion: reference counted objects

Sven Barth pascaldragon at googlemail.com
Sat Sep 20 12:05:55 CEST 2014


On 20.09.2014 06:36, Fabrício Srdic wrote:
> Hello,
>
> In platforms with managed code (.NET, Java), objects are automatically
> freed by the memory manager / garbage collector.
>
> Would not it be interesting to have a similar feature in FPC?
>
> For example, through a root class where its objects are counted by
> reference, like the TInterfacedObjects.Thus, the programmer would be
> free from having to manually release objects.

It's already on my radar since Delphi's NextGen compiler introduced ARC 
(Automatic Reference Counting) for TObject and its descendants.

Though while I'd like to implement them I don't consider them the holy 
grail especially since the programmer needs to take care of cycles in 
the objects (Delphi solves this by allowing the programmer to declare 
fields, paremeters and such as "weak", thus not changing the reference 
count).

Regards,
Sven




More information about the fpc-devel mailing list