Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > if (obj) { > /* use obj */ > refcount_dec(&obj->refs); /* should never hit 0 */ > } You've missed a bit: We need to tell the gc to run when we reduce the refcount to 1: if (obj) { ... if (refcount_dec_return(&obj->refs) == 1) schedule_gc(); } David