Re: alloc init thread safe?
Re: alloc init thread safe?
- Subject: Re: alloc init thread safe?
- From: email@hidden
- Date: Thu, 8 Mar 2007 13:28:11 -0700
I tried doing a Release build. This found two identically named
variables within .m files. After fixing this, the BOOL method bug
never reappeared.
I removed the locks in the alloc init method. In the Debug build,
this problem reappears in almost every test after startup, but not on
subsequent tests. The context is this: I have an object which
receives data in a subthread, then propagates data to two other
objects in two other subthreads. These latter two objects seem to
try to access the alloc init method at the same time. One or the
other always fails in the latest tests in the first test after
startup, but not when the document containing them is closed and
reopened and retested.
But the problem goes away in the Release build. So I'll have to do
more experimenting to see if I can make it work in the Debug build.
That build dropped me into the Debugging Console once, which I had
never seen before, for some reason which was unclear.
Thanks,
DC
On Mar 8, 2007, at 12:46 PM, David Carlisle wrote:
Thanks for the list of suggestions.
I've confirmed that when the BOOL method returns a NO, the object
receiving the method call is being allocated correctly just before
the call. It fails about 15% of the time. The original alloc init
bug has not failed since I put locks around it, but that doesn't
explain the problem.
I'll work through your list, probably starting with changing the
optimization level if that has a chance of flagging an error.
On Mar 8, 2007, at 12:34 PM, Bill Bumgarner wrote:
On Mar 8, 2007, at 11:09 AM, David Carlisle wrote:
if I have an C2_alloc_init method randomly returning a null, and
another method randomly returning a NO, that seems to be the same
problem, if NO == null.
Right -- I asked about warnings because seemingly random return
values are often the result of ignoring warnings. Go for the
obvious / simple solution first, even if unlikely, then dive deeper.
Everything works as expected with threading disabled? Zerolink is
off (it can be a bear at times)? Any behavior change between
deployment and debug builds? Changing the optimization level
show anything new (the compiler can do additional safety checks w/
optimization enabled)?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden