Instead of overwriting common memory management functions, you can use custom allocators for sensitive objects.
The API for key keys is written in C and uses Core Foundation objects such as CFDictionary, CFData, and CFString. Although it is true that these objects are “free” connected to their Objective-C counterparts and are generally interchangeable, they have some features that are not available from Objective-C. One of these features is the use of custom allocators.
CFDictionaryCreate , for example, accepts an argument of type CFAllocatorRef , which in turn can be created using CFAllocatorCreate . A dispenser contains pointers to functions for distribution and release, among other things. You can use custom functions to overwrite reasonable data.
source share