Zombies — This lets you quickly detect when an object is used after it has been deallocated. You can learn more about it in the Finding zombies section of the Instruments Help. There was also an excellent WWDC video about this, namely, WWDC 2010 Session 311 Advanced Memory Analysis with Instruments. Unfortunately this is no long 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. You can learn more about this in the Address Sanitizer article. 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.
Older tools — There’s 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.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
16 Nov 2017 — First posted.
2 Nov 2018 — Updated to include a reference to WWDC 2018 Session 414 Understanding Crashes and Crash Logs.
22 Jan 2019 — Fixed the link to libgmalloc.
30 Oct 2019 — 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.
23 Oct 2020 — Fixed some formatting errors.