[fpc-devel] Proof of Concept ARC implementation

Sven Barth pascaldragon at googlemail.com
Sun Oct 26 11:14:40 CET 2014


On 26.10.2014 10:44, Hans-Peter Diettrich wrote:
>> A further problem might be legacy code which gets passed a reference
>> counted instance (on which ARCIncRef was called to keep it alive) and
>> which then calls Free. Might not be the intended result by neither
>> code... This might be the reason of Embarcadero to implement Free as a
>> no-op and add a new DisposeOf which does what you suggested.
>
> Then Delphi compatibility has to be maintained. Is DisposeOf fully
> automatic, or can it be overridden or otherwise influenced (field
> sequence...)?

The current implementation isn't Delphi compatible anyway, because in 
Delphi TObject is itself reference counted.

DisposeOf merely calls the destructor and marks the object as "disposed 
of" (either by using a Boolean field that is part of TObject or by 
misusing the topmost bit of the reference count, I don't know). This way 
the destructor isn't called a second time once the reference count 
really reaches 0.

Regards,
Sven



More information about the fpc-devel mailing list