Yes it does, Kyle! I was so focused on being an array controller binding idiot that I forgot that I was also a memory management fool. I was about to google that NSZombie thing - which I will do next, when I took one more look at the code, this time with a clear focus on memory. The releases looked reasonable, leaving only the possibility of a missing retain somewhere.... Voila! I added a retain message where I create the weapons array in the Combatant class. Awesome - it works!!!

- (id)init{
        NSLog(@"Initializing combatant");
        [super init];
        // Create initial weapons
weapons = [[NSMutableArray arrayWithObjects:@"Dagger", @"Sword", @"Pike", nil] retain];
        return self;
}

Pardon my thinking as I write.... I am guessing I need the retain because this thing is being autoreleased. AND it worked in the command line because the pool isn't drained in the middle of my session, but with a GUI it is drained on each event loop. Of course. Duh. Thanks guys!

- Leon

On Aug 24, 2009, at 9:37 , Kyle Sluder wrote:

On Mon, Aug 24, 2009 at 9:14 AM, Leon Starr<[email protected]> wrote:
There was no error message in the session when I originally submitted my question. But I just tried running my code (unchanged) this morning several times and found that SOMETIMES I get an error in the console just before the
stack trace.  And it is not always exactly the same, but the theme is
similar. It always involves something about not being able to create an
array.  Here's the latest:

Smells like memory mismanagement.  Set NSZombieEnabled=YES (Google for
NSZombie if you don't know what that means) and try again.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to