There's an undocumented function in the runtime API, which appears (on the basis of a few toy programs) to do what its name suggests it does:
OBJC_EXPORT void objc_disposeClassPair(Class cls)
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
However, detailed information is fairly thin on the ground. So this is more a cluster of related questions than a single one:
- Are there any good articles / blog posts around that look at it, or does anyone have any experience of using it (A quick google suggests that the PyObjC developers at least looked into using it at one point)?
- Are disposed-of classes completely deallocated (would an application that frequently created and deleted classes leak memory?)
- Are there any gotchas worth keeping in mind beyond the usual about undocumented APIs?
- Where is it (/might it be) used by Apple? NSBundle unloading? KVO?