Idea #1 on integrating RC with GC

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Wed Feb 5 11:24:26 PST 2014


On Wednesday, 5 February 2014 at 19:13:01 UTC, Adam D. Ruppe 
wrote:
> It sounds to me like... a separate type. The deallocator is the 
> destructor!

Yes, but "destructor" of the reference counter object is 
"decrease count by one", when it goes to zero. Not when it is 
destroyed.

Sure, you can use classes for it, but I don't think you want to. 
It is better to have a uniform reference counter object that can 
be fully inlined with no function calls as the general case and 
then only call the external "deallocator" with itself as 
parameter when it is present.


More information about the Digitalmars-d mailing list