I take it that a "leak" is a ref from somewhere else than the stack.
It could be made transitive too - a ref from another object without that bit set isn't a leak either. But otoh you'd have to set the bit recursively in that case.
This can only be applied to thread local data, but in that case I think normal refcounting still is fine: It preserves the semantics and it's not necessary to do it atomically.
/ Martin Stjernholm, Roxen IS
Previous text:
2004-02-05 12:39: Subject: Re: Default backend and thread backends?
The necessary atomic refcounting on global data is a similar expense, though. Hmm, maybe one could relax the refcount garbing on global data and let it become garbage instead.
I think there are known gc algorithms that use an essentially one-bit reference count. Newly created objects have the bit clear (similar to the global/local flag set to local). Whenever a reference "leaks" (a concept that has to be defined more precisely), the bit is set. When an object goes out of scope, check the bit and deallocate it immediately if it is clear, and leave it to the gc if the bit is set.
/ Niels Möller (vässar rödpennan)