On Tue, Jan 12, 2010 at 2:51 PM, Rainer Standke <li...@standke.com> wrote: > > Here is the code that displays the sheet: > > NSArray *theContextInfo = [[NSArray alloc] init];
This creates a new array that you are responsible for releasing when you're finished with it. > theContextInfo = [NSArray arrayWithObject:objTBD]; This creates a new array that you are *not* responsible for releasing. Because you assign the result to theContextInfo without releasing the previous array, that one leaks. Because you expect to use the new array later, you should have retained it. > What am I missing? (Another newbie thing I suspect...) The memory management guidelines: <http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html> Additionally, I'd recommend making theContextInfo into an instance variable, rather than passing it through the contextInfo. You can then write (or @synthesize) an accessor method that encapsulates all of the relevant memory management into one place, which is *far* less error-prone than scattering -retain and -release calls all over the place. sherm-- -- Cocoa programming in Perl: http://www.camelbones.org _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com