Test to validate proper reference counting of objects