On Oct 15, 2013, at 6:22 PM, Graham Cox <graham....@bigpond.com> wrote:
> > On 15/10/2013, at 11:10 PM, "Mills, Steve" <smi...@makemusic.com> wrote: > >> No, it's the itemArray. Ignore the code you can't see in the loop. It's >> simply asking each item for its tag. > > > OK, so if that's the case, I'm interested in knowing whether each call to > -itemArray returns the same object or a different one each time. In my tests I NSLog them and they're different every time. BTW I repeated my test on 10.8.5. The project does not use ARC and Leaks does not show leaks after I call itemArray thousands of times in response to button presses. Allocations go up and come back down as they should. > If it's different, then it's either a copy of some internal array or > something built on the fly. It should therefore be autoreleased. If your > (incorrect, but understandable) attempt to call -release causes a crash, then > it definitely is being (over)released at some point, so it can't be leaking > as long as there really is an autorelease pool in place. So that might lead > you to look at how and where these methods are being called, e.g. sure > they're on the main thread, within a runloop event handler of some sort? As a sort of test probe you could create some other object that should definitely *not* leak, and see if it does. Next to the call to itemArray, something like NSArray* items = [self itemArray]; for(NSMenuItem* item in items) blah; for (NSInteger i = 0; i < 10000; i++) [[[NSObject alloc] init] autorelease]; If you leak thousands of NSObject instances, you know it's not a problem specific to itemArray. More likely it has to do with the questions Graham posed about when your method is getting called. --Andy _______________________________________________ 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