Reputation: 73
what happens if i retain an object multiple times. Then, will autoreleasing it once, delete it from the memory when the autorelease pool is drained; or do i have to autorelease it as many times as i retained it ?
Upvotes: 3
Views: 245
Reputation: 170859
Autorelease schedules an object to be released once in some time in future (i.e. when current autorelease pool is drained). So if you retain an object several times you need to (auto)release it the same number of times to compensate that
Upvotes: 5