• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: alloc init thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: alloc init thread safe?
      • From: mmalc crawford <email@hidden>
References: 
 >alloc init thread safe? (From: email@hidden)
 >Re: alloc init thread safe? (From: Chris Suter <email@hidden>)
 >Re: alloc init thread safe? (From: David Carlisle <email@hidden>)
 >Re: alloc init thread safe? (From: "Shawn Erickson" <email@hidden>)
 >Re: alloc init thread safe? (From: David Carlisle <email@hidden>)
 >Re: alloc init thread safe? (From: Bill Bumgarner <email@hidden>)
 >Re: alloc init thread safe? (From: David Carlisle <email@hidden>)
 >Re: alloc init thread safe? (From: Bill Bumgarner <email@hidden>)
 >Re: alloc init thread safe? (From: David Carlisle <email@hidden>)

  • Prev by Date: Re: alloc init thread safe?
  • Next by Date: Re: alloc init thread safe?
  • Previous by thread: Re: alloc init thread safe?
  • Next by thread: Re: alloc init thread safe?
  • Index(es):
    • Date
    • Thread