On Oct 15, 2013, at 4:30 PM, Steve Mills <smi...@makemusic.com> wrote:
> On Oct 15, 2013, at 14:50:51, Steve Mills <smi...@makemusic.com> wrote:
> 
>>      NSArray*                items = [self itemArray];
>>      
>>      for(NSMenuItem* item in items)
>>              blah;
>>      
>>      [items release];
> 
> 
> Ah, this one won't work (I didn't try it before when I wrote my original 
> message) because itemArray actually does return a new *immutable* array,

itemArray is declared to return an NSArray, so you should treat it as immutable 
whether or not it happens to return a mutable array.  In any case, its 
mutability has nothing to do with whether itemArray is leaking.

> but it's not release-able. Doing so produces a crash.

This would be expected if itemArray isn't really leaking.  FWIW, I did a quick 
test, calling itemArray hundreds of times, and Leaks didn't report any leaks.  
Is it possible the arrays you are leaking are elsewhere?  I'm running 10.9, so 
if you're running an earlier OS it's also possible there was a leak and Apple 
fixed it.

--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

Reply via email to