On Oct 16, 2013, at 10:08:03, Ken Thomases <k...@codeweavers.com> wrote:
> Released to the point of being deallocated? Deallocation would also be > indicated in the history. # Address Category Event Type RefCt Timestamp Size Responsible Library Responsible Caller 0 0x7eb9c160 __NSArrayI Malloc 1 29:21.944.045 96 AppKit -[NSMenu itemArray] 1 0x7eb9c160 __NSArrayI Autorelease 29:21.944.054 0 AppKit -[NSMenu itemArray] 2 0x7eb9c160 __NSArrayI Release 0 29:30.753.222 0 Foundation -[NSAutoreleasePool drain] 3 0x7eb9c160 __NSArrayI Free 0 29:30.753.229 -96 Foundation -[NSAutoreleasePool drain] They all appear to be freed, although I was sure in previous runs I saw them only with only 2 history events instead of 4. Something is amiss somewhere (obviously not with the itemArrays, at least for this particular run of the app), because our memory footprint keeps growing, yet there are no leaks other than a few very small (we're talking bytes, not kilobytes) objects that appear to be beyond our control. So at this point, let's finish this thread by going back to my original question. Is it OK to use the private instance variable _itemArray in NSMenu since the methods we've added are *extensions* of NSMenu and not a subclass? They simply iterate over the array and ask each item for its tag and call the same method on submenus. Below is the way it is now, with [self itemArray] being called, which seems inefficient because it creates an immutable copy of the array. If NSMenu were my own class, I'd definitely use the instance variable for this sort of routine. - (NSMenuItem*)itemWithTag:(NSInteger)tag searchSubmenus:(BOOL)searchSubmenus depthFirst:(BOOL)depthFirst { if(!depthFirst) { id item = [self itemWithTag:tag]; if(item) return item; } if(searchSubmenus) { for(NSMenuItem* item in [self itemArray]) { if([item hasSubmenu]) { NSMenuItem* subitem = [[item submenu] itemWithTag:tag searchSubmenus:searchSubmenus depthFirst:depthFirst]; if(subitem) return subitem; } } } return [self itemWithTag:tag]; } -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com