title: Is it possible to replace malloc on iOS?
body: <p>I'd like to use a custom <code>malloc</code> and <code>free</code> for some allocations in an iOS app, including those made by classes like <code>NSMutableData</code>.</p>
  
  <ul>
  <li>Is this possible?</li>
  <li>If so, how do I do it?</li>
  </ul>
  
  <hr>
  
  <p><sub>What I'd actually like to do is zero out certain data after I've used it, in order to guarantee forward security (in case the device is lost or stolen) as much as possible. If there's an easier way to do this that doesn't involve replacing <code>malloc</code> then that's great.</sub></p>
  
  <p><sub>I believe I need to replace malloc in order to do this because the sensitive data is stored in the keychain --- and I have no option other than to use <code>NSDictionary</code>, <code>NSString</code> and <code>NSData</code> in order to access this data (I can't even use the mutable versions).</sub></p>