Not.
autorelease exists only for compatibility, before iOS 5, you will need to do:
Thing *myThing = [[Thing alloc] init]; // Retain count: 1 [myArray addObject:myThing]; // Retain count: 2 [myThing release]; // Retain count: 1
With the above code, the responsibility for saving the object is transferred to the array, when the array is deleted, it frees its objects.
Or in the case of auto-advertising.
- (MyThing*)myMethod { return [[[MyThing alloc] init] autorelease]; }
Then it will free the object after loading it into NSAutoReleasePool and delete it after deleting it.
ARC will take care of this now, it pretty much inserts the missing parts for you, so you donโt have to worry about it, and the beauty of this is that you get the benefits of link counting (versus garbage collector), due to a higher compile time check to complete the ARC step, but end-users don't care about compile time.
Add to this that you now have strong and weak (vs their brothers without ARC retain and assign , the later version is still useful for non-saved things), and you get a good programming experience without tracing the code with your eyes and counting the number of deductions in the left hand.
Can
source share