В Objective-C, есть ли способ узнать, какие объекты удерживают другой объект?
Например, у меня есть коллекция объектов MyClass, и если я проведу по ним итерацию, чтобы получить счетчик хранения для каждого объекта, я вижу счетчик в 2. Как я могу узнать, кто является владельцами?
for (NSString *aKey in aDictionaryOfMyObjects)
{
MyClassObject *myClassObj = [aDictionaryOfMyObjects objectForKey:aKey];
// following shows a retain count of 2. Presumably, the first count is
// due to myClassObj is held as the value in NSDictionary and second is because I
// I just acquired a pointer to it above. I'd like to find out who exactly
// might have references to myClassObj.
NSLog(@"retain count = %d", [myClassObj retainCount]);
}