check: add macro to check for memory refcount