GC, the simple solution

Lionello Lunesu lionello at lunesu.remove.com
Sun Jun 4 22:39:25 PDT 2006


> They definitely have to be synched: because in decref you've got to:
>
> 1. ref--;
> 2. if( ref == 0 ) free(ptr);
> 3. if( obj.canHaveCycles ) registerForCycleCheck(obj);
>
> If not more.  You then also need the incs synched with that, otherwise
> you could end up "ref++"ing in the middle of "free(ptr)".

The thread doing the ++ apparently has a pointer to the object without a 
reference. How could that ever happen?

L. 





More information about the Digitalmars-d mailing list