My question is how do the current versions of Foundation (or the Objective-C runtime libraries, as it seems to have), preserve the number for NSObjectderived objects? As I could see on NSObject.mm , NSObjectthere is no ivar called in the interface package retain count. Instead, it looks like some kind of table or map that contains link counts for each object. But if the account holding is really performed with the card, not too complex operations retainand releaseto complete the sale (as in this case it is necessary to lock and unlock the mutex, look for the map to find the right object, apart from the fact that in a multithreaded environment, only one object can be saved / released at a time)?
I did not find anything related to setting the save counter to 1 when selecting a new object, not _objc_rootAllocWithZonein NSObject.mm (which, apparently, is a function called [NSObject alloc]), nor _class_createInstanceFromZonein objc-runtime-new.mm (which called later _objc_rootAllocWithZone).
source
share