Re: Leak problem in Cocoa NSMutableArray/objectEnumerator
Re: Leak problem in Cocoa NSMutableArray/objectEnumerator
- Subject: Re: Leak problem in Cocoa NSMutableArray/objectEnumerator
- From: Heath Raftery <email@hidden>
- Date: Sat, 28 Aug 2004 01:17:33 +1000
Leslie,
You've most likely addressed this, but the first thing which struck me
as I read your email was the method of "creation" of your array. I
thought it might be best to mention it, just in case!
On 27/08/2004, at 8:52 PM, Professor Leslie Smith wrote:
NSMutableArray *MyArray is declared in the header.
It is created using
[NSMutableArray arrayWithCapacity: 100] ;
and then filled with NSNumber objects.
How and when exactly is this done? Do you realise that the array...
factory methods return an autoreleased object? That is, if you created
MyArray with MyArray = [NSMutableArray arrayWithCapacity:100]; then it
is up for garbage collection as soon as the current autorelease pool is
released, which is likely to be as soon as this current scope ends. Is
there any chance you actually meant the following?
//create MyArray (which is declared in the header, as a member of my
class)
MyArray = [[NSMutableArray alloc] initWithCapacity:100];
Heath
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.