I never seem to get this right. I've got a method that returns a mutable array. What is the proper way to return the array and avoid potential memory leaks?
If I plan to store the results locally inside another view controller, does that affect the way the array should be returned?
Lastly, what if it's just an non-mutable array? Does that require a different technique?
thanks, Howie
allocyou don't have toreleasemeaning that it MUST be autoreleased. Wanted to leave this link too developer.apple.com/mac/library/documentation/cocoa/Conceptual/…autoreleaseit, but autoreleasing is effectively the same as releasing (since that's what it does, just not immediately). What you meant is that an object created by a method withoutalloc,new, orcopyin its selector is already autoreleased, so you can just return that.