• 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: Is _objc_flush_caches_(Class) necessary to swizzle methods?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is _objc_flush_caches_(Class) necessary to swizzle methods?


  • Subject: Re: Is _objc_flush_caches_(Class) necessary to swizzle methods?
  • From: Glenn Andreas <email@hidden>
  • Date: Fri, 24 Sep 2004 08:55:46 -0500

At 4:47 AM -0400 9/24/04, DumberThanDanQuayle wrote:

Does anybody know what the story with "_objc_flush_caches_(Class)" and method swizzling really is?

From my understanding delving the depths of the runtime, _objc_flush_caches_ is needed because the runtime maintains cache of recent methods & imps used when dispatching. So once it figures out that [foo something] is at 0x123400, it keeps that in the cache for Foo.


If you change foo something to point to 0x567800, the cache will still refer to the old version, so the next time you call [foo something] 0x123400 gets executed, and not your new 0x567800.

If it is a method that has never been called, you could probably get away without calling it.

OTOH, I've never seen a problem with inheritence/ivars when doing this (since that information doesn't use any of the method dispatch cache anyway).


--
Glenn Andreas email@hidden <http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Is _objc_flush_caches_(Class) necessary to swizzle methods?
      • From: DumberThanDanQuayle <email@hidden>
References: 
 >Is _objc_flush_caches_(Class) necessary to swizzle methods? (From: DumberThanDanQuayle <email@hidden>)

  • Prev by Date: Newbie:Attributed Text Strings and NSTextView
  • Next by Date: Loading a view from a nib multiple times
  • Previous by thread: Is _objc_flush_caches_(Class) necessary to swizzle methods?
  • Next by thread: Re: Is _objc_flush_caches_(Class) necessary to swizzle methods?
  • Index(es):
    • Date
    • Thread