I'm in the process of ironing out a few memory allocation issues in my iPad app and have spent a long while watching CFString
grow and grow and grow (as a still living object) under the zombies instrument, it wasn't until I switched to the Leaks or allocations instrument that I noticed it doesn't grow much at all (created and still living remains stable throughout) can anyone explain why this is happening in zombies but not leaks or allocations instrument, its making me wonder if CFString
is an issue or just a false positive thrown up by zombies ....
Asked
Active
Viewed 1,098 times
2
-
Are you referring to all of your strings or just a certain instance/field? – Nick Weaver Apr 08 '11 at 13:19
-
generally lots and lot of CFStrings from seemingly everywhere in the app, these are living allocations not leaks – Matt Apr 08 '11 at 15:15
1 Answers
3
Zombies specifically doesn't release memory so that you can see if you are accessing memory after you release it. You can't try to detect leaks while using zombies.
Under the Zombies instrument, you should just be trying to detect zombies. The rest of the behavior of your application isn't necessarily going to be the same. To maximize the chance that you detect accessing a zombie, non-standard allocators might be used.

Lou Franco
- 87,846
- 14
- 132
- 192
-
im not sure that is 100% correct, I can see other allocations rising and falling, and the number of living objects rising and falling but CFString seems to spiral out of control, this is allocations NOT leaks i am looking at – Matt Apr 08 '11 at 15:17
-
1CFString uses custom allocators -- perhaps they can reuse memory. If so, not releasing will cause more allocations. Also, if the allocator can share instances that aren't known by the user to be the same (using reference counting under the hoods) -- then this has to be turned off or you won't be able to detect misuse. I suspect that this is expected behavior. – Lou Franco Apr 08 '11 at 16:54
-
+1 @Matt many of the allocations you see are likely allocated via NSString apis. NSString is CFString - you can trace the heaviest paths, or the paths you are concerned with (in Instruments). these (NSStrings) would not be release, and intentionally leaked as Lou stated. Instruments can record the callstack of every allocation's creation as well as every ref count operation. – justin Apr 08 '11 at 17:36