Xcode Zombies Shows CFArray Increases Active Bytes

I have not used Zombies before and I must admit that I'm not sure what he is doing. However, one thing concerns me:

CFArray seems to be constantly expanding its Live Bytes and # Living columns, as well as a couple of mallocs, which I believe are related. This is when my application just sits there, rendering (OpenGL) and waiting for input.

I tried to run the tool for leaks, and this does not show that I get memory leaks during this period or even more allocations. No provision for anything, let alone CFArray.

So which of the two tools should I believe? Or is it just that I don’t understand what the Zombies tool actually does?

If there is some decent zombie documentation anyone can tell me, that would be cool. Apple docs seem to have masked it a bit.

+4
source share
2 answers

NSZombies basically replaces freed objects with a placeholder to notify the developer if he was drawn after dealloc (obviously this is bad). This helps to resolve issues with the save / release.

By turning it on, your application will look like it is passing memory like a sieve, because nothing will ever be truly released. Typically, I use NSZombies to find specific crashers during debugging (or you can enable Zombies in the Allocations tool, which should also warn you that memory usage will only increase) ... I use memory leak and heap allocation tools to analyze memory in a functioning application.

Another good question / answer for SO: What is NSZombie?

+6
source

allows zombies to see that objc instances are not freed when their hold count reaches 0 (usually dealloc is called at this time, and the object's memory will be freed). in particular, dealloc will be called, but the object will not be freed, and the number of links will be available for future use.

of course, there is more, and this is an implementation detail: somewhere in the messaging system, the system will verify that you are not reporting zombies (zombies are an object that has a counter of 0). if you tell zombies, the system will detect this for you (as you might encounter when starting with zombies turned on).

+2
source

Source: https://habr.com/ru/post/1338164/


All Articles