Hmm, I guess you're right. You might need some sort of type modifier like tmp or global to prevent the reference from interfering with the garbage collector.
If an object has a refcount of 0 it's deleted immediately, so this proc would never work.
Being able to read the refcount could be borderline useful, but I've considered that before and as I recall there was something wrong with it that I couldn't work out.