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 disposed-of classes completely deallocated (would an application that frequently created and deleted classes leak memory?)
Yes, they will be completely deallocated. If you look at the cycle
function in http://www.opensource.apple.com/source/objc4/objc4-437/test/classpair.m, you will find that it both allocates and deallocates multiple classes. The main
implementation below runs that function 100 times, and checks for leaks, which indicates that they wouldn't release an implementation which leaked significantly. If you want to find out more, you should look through the code in http://www.opensource.apple.com/source/objc4/objc4-437/runtime/. You can probably find apple's actual code for both functions in there somewhere, as well as where it is used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With