One thread could decrement the refcounter and free the resource while another thread is scheduled to do the same. On a system under load, there is no requirement that the second thread will be scheduled immediately after the first thread has done the decrementing. At the time the second thread does continue, the memory might actually have arbitrary content; potentially even satisfying any test to free the memory again.

Therefore, I think that the testing _should be atomic_. And in fact, the `r->owner` access should only be done if we can be sure that the object is still in place (which we can't at all).