Search code examples
iosxcodenszombie

~500 NSZombie warnings on Xcode memory graph from iOS 13 application


When I build a memory graph of my app I see ~500 memory warnings. When I look these are all in the Malloc Blocks category and are all (mostly) prefixed with NSZombie. I'm assuming this is what it normally looks like when running on device but I want to make sure.

Is this normal?

Xcode screenshot of NSZombies


Solution

  • No, it isn’t normal. You’ve got Zombies turned on.

    enter image description here

    That isn't normal; it's a special build mode for when you want to track down dangling pointers. A Zombie is a leak by definition, hence the warnings. None of your transient objects ever goes out of existence. And Cocoa makes lots and lots of transient objects (as you've just discovered)! There is certainly no point doing a memory graph with Zombies on, and there is no point turning Zombies on unless you are in the middle of tracking down a dangling pointer.

    Turn zombie mode off!