Using objc_disposeClassPair ()

There is an undocumented function in the runtime API that appears (based on several toy programs) to do what its name suggests:

OBJC_EXPORT void objc_disposeClassPair(Class cls) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; 

However, the detailed information is pretty thin on the ground. Thus, it is more a cluster of related issues than one:

  • Are there any good blog articles / blog posts around this, or does anyone have experience using it (quick Google suggests that PyObjC developers at least studied its use at some point)?
  • Classes fully freed are allocated (will there be a memory leak if the application that often created and deleted classes?)
  • Are there any considerations worth considering besides the usual ones about undocumented APIs?
  • Where is this (maybe) used by Apple? Upload NSBundle? Quo?
+4
source share
1 answer

Utilized classes are completely freed (will there be a memory leak if the application that often created and deleted classes?)

Yes, they will be completely released. If you look at the cycle function at http://www.opensource.apple.com/source/objc4/objc4-437/test/classpair.m , you will find that it allocates and frees several classes. Below is the implementation of main , which runs 100 times and checks for leaks, which indicates that they will not release an implementation that has a significant leak. If you want to know more, you should view the code at http://www.opensource.apple.com/source/objc4/objc4-437/runtime/ . You can probably find the actual apple code for both functions there somewhere, and also where it is used.

+2
source

All Articles