Re: Over-release caused by Instruments?
Re: Over-release caused by Instruments?
- Subject: Re: Over-release caused by Instruments?
- From: Dave Keck <email@hidden>
- Date: Tue, 2 Nov 2010 00:38:19 -0400
Thanks all for the suggestions. I've studied the code more thoroughly
and can't find any possible races – it's a pretty run-of-the-mill
producer/consumer model:
===== Producer =====
components = [NSMutableArray array];
message = [NSPortMessage initWith... components: components];
@synchronized(messages)
{
[messages addObject: message];
}
===== Consumer =====
@synchronized(messages)
{
message = [[[messages objectAtIndex: 0] retain] autorelease];
[messages removeObjectAtIndex: 0];
}
[delegate handlePortMessage: message];
==========
Where the `components` array is the object supposedly being
over-released, and is never used beyond being populated and then
supplied to NSPortMessage's initializer, all on the producer thread.
Interestingly, the over-release disappears if the producer looks like
this:
===== Producer (works) =====
components = [[NSMutableArray alloc] init];
message = [NSPortMessage initWith... components: components];
@synchronized(messages)
{
[messages addObject: message];
}
[components release];
==========
I'm completely stumped; I'll see if I can distill the code down to
something that I can post to the list.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden