• 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: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?


  • Subject: Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?
  • From: Greg Parker <email@hidden>
  • Date: Wed, 22 Feb 2012 15:02:59 -0800

On Feb 20, 2012, at 10:16 AM, Matt Neuburg <email@hidden> wrote:
> On Fri, 17 Feb 2012 16:06:01 -0800, Greg Parker <email@hidden> said:
>> No. objc_msgSend() also reads from the class's method cache and method list. It's possible for the receiver object to be valid, but still crash because of a memory smasher that hit the method cache or method list
>
> It's also possible for the receiver object to be valid but the wrong object. I remember in my early Cocoa programming days I mismanaged the memory for an NSString object and was mystified when *another NSString object took its place*. I believe NSZombie would have tracked that down by occupying the slot pointed to by the variable and not letting some other string slip into it. In other words, believe in zombies, not in your intuitions about how everything looks okay. :) m.

Having a prematurely-deallocated object replaced by a new object of the same type can lead to all sorts of exciting bugs, but a crash in objc_msgSend() itself is not one of them. (And yes, NSZombie is good at catching such cases. The dead object's address will not be re-used, at least not any time soon.)


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: binding a binding?
  • Next by Date: Re: NSStepper - useless?
  • Previous by thread: Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?
  • Next by thread: Re: Bogus Illegal Datasource Warning
  • Index(es):
    • Date
    • Thread