<p>Am 31.10.2014 06:05 schrieb "Hans-Peter Diettrich" <<a href="mailto:DrDiettrich1@aol.com">DrDiettrich1@aol.com</a>>:<br>
><br>
> Sven Barth schrieb:<br>
><br>
>> On 30.10.2014 04:14, Hans-Peter Diettrich wrote:<br>
><br>
><br>
>>> I wonder how difficult it would be to implement the existing Interface<br>
>>> refcounting model for TObject, so that this runtime variation could be<br>
>>> tested and benchmarked as well, in addition to the current compiletime<br>
>>> approach. According to the problems of the compiletime approach,<br>
>>> revealed in this thread, it looks not viable to me at all.<br>
>><br>
>><br>
>> The code would mostly be the same as the one I already implemented. Add "virtual" to the ARCDecRef, ARCIncRef and ARCRefCount methods of TObject, adjust the RTL helper functions to not expect a refcount field at a specific offset, remove the restrictions that reference counting is only done for classes marked as "refcounted" and you're done...<br>
><br>
><br>
> Looks quite easy :-)<br>
><br>
> Could you introduce this feature into your branch, by conditional compilation?</p>
<p>When I find the time I'll try.</p>
<p>><br>
><br>
> Mark just pointed me to another problem, possibly unhandled yet. Interface refcounting must be updated, as soon as the underlying object becomes refcounted as well. Do you already have an idea how to handle refcounting for classes with interfaces?</p>
<p>Simply implement the AddRef and Release methods using ARCIncRef and ARCDecRef and return ARCRefCount.</p>
<p>Regards,<br>
Sven</p>