title: Wrap malloc / free in Android NDK
body: <p>Is it possible to wrap malloc / free functions in Android NDK?</p>
  
  <p>I have checked all the solutions from <a href="https://stackoverflow.com/questions/262439/create-a-wrapper-function-for-malloc-and-free-in-c">create-a-wrapper-function-for-malloc-and-free-in-c</a> but none of them worked.</p>
  
  <p>In the top-voted answer there are 4 approaches proposed:</p>
  
  <ol>
  <li>Usage of hooks -> hooks are not available in bionic</li>
  <li>Usage of dlsym -> crashes with 'SEGV_MAPERR'</li>
  <li>not applicable for Android</li>
  <li>not applicable for Android</li>
  </ol>