When to call autorelease ?
When creating objc objects, how I can tell if autorelease calls are necessary? Python objects are garbage collected. Can I rely on this for objc objects as well?
I looked at sample codes provided by @omz , but cannot find a pattern when to call autorelease.
Specifically, do I need to call autorelease when creating an object that subclass
UITextView? And what about
As a simple rule of thumb: If you see
new(), you need to balance it with
autorelease()somewhere. Objects that are created by other means (returned from a method that isn't called
init...()) are usually already autoreleased.
Thanks @omz The pattern seems reasonable to follow.