Standard Memory Debugging Tools

This thread has been locked by a moderator; it no longer accepts new replies.

In many cases I’ll be talking to folks with a memory management problem and I’ll say “You should investigate this with the standard memory debugging tools.” They then turn around and ask me “What are those tools?” Well, this is what I mean:

  • Zombies — This lets you quickly detect when an object is used after it’s been deallocated. Learn more about it in the Finding zombies section of the Instruments Help and in Investigating crashes for zombie objects. There was also an excellent WWDC video about this, namely, WWDC 2010 Session 311 Advanced Memory Analysis with Instruments. This is no longer available in the video archive but if you can find a copy it’s well worth a watch.
  • Address Sanitizer — This is a lower-level tool that finds a variety of common memory management issues, including use after free and buffer overruns. Learn more about this in Diagnosing memory, thread, and crash issues early and the various articles it links to. There’s also a good discussion of this tool, and other Xcode runtime diagnostic tools, in WWDC 2017 Session 406 Finding Bugs Using Xcode Runtime Tools (also no longer available from Apple).
  • Hardware memory tagging — If you have access to a device with hardware memory tagging — starting with the A19 or M5 processors — consider enabling Memory Integrity Enforcement (MIE). For the details, see Enabling enhanced security for your app or watch Secure your app with Memory Integrity Enforcement. Even if you don’t want to do that for your production app, enable it just for development by checking Hardware Memory Tagging in the Options tab of Xcode’s scheme editor.
  • Older tools — There are a variety of older tools that might be useful in some specific circumstances. See the Enabling the Malloc Debugging Features section of the Memory Usage Performance Guidelines for more information about these. Of specific interest is libgmalloc, which is documented in a UNIX man page.

For some practical examples of how to identity a memory management crash report and then investigate that crash with these tools, take a look at WWDC 2018 Session 414 Understanding Crashes and Crash Logs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Revision History:

  • 2026-03-02 Added a discussion of hardware memory tagging.
  • 2023-05-09 Added a link to Investigating crashes for zombie objects.
  • 2023-03-22 Removed another WWDC session video link. Made minor editorial changes.
  • 2020-10-23 Fixed some formatting errors.
  • 2019-10-30 Removed the link to WWDC 2010 Session 311 Advanced Memory Analysis with Instruments because it’s not long available in the archive. Refreshed all the other links.
  • 2019-01-22 Fixed the link to libgmalloc.
  • 2018-11-02 Updated to include a reference to WWDC 2018 Session 414 Understanding Crashes and Crash Logs.
  • 2017-11-16 First posted.
Boost
Standard Memory Debugging Tools
 
 
Q