Debugging with Autorelease Pool and Environment Variables

I have a debugging problem with a project. This project is not the best written one, it has a lot of memory problem (leaks, zombies). The project is not written by me, so I don't even know the "minor miracles" in it. The problem is, that somewhere in the project there is an NS(Mutable)Array with autorelease option. Maybe on the other part there is a release given (I cannot locate the exact code line, where it is).

When I run the project on device, after opening several views comes a memory warning. The didReceiveMemoryWarning method gets comed, but the viewDidUnload not.

Maybe the project destroys that array with the release given, and when the memory warning comes and destroys the autorelease pool, the array retain count is -1 => it is a zombie. The problem is, that in debugging mode there isn't any debug line or call stack shown, only Did receive memory warning.

[Classname didReceiveMemoryWarning]

-> and crash. I have enabled the environment variables: NSZombieEnabled , NSHangOnUncaughtException ,

NSAutoreleaseFreedObjectCheckEnabled, NSDebugEnabled, MallocStackLogging, MallocStackLoggingNoCompact, NSDeallocateZombies , but no result.

Have you got any idea what should I do to find out which array is the guilty (without rewriting the whole project:P)?


Have you tried the malloc_history command?

http://www.cocoadev.com/index.pl?DebuggingAutorelease

链接地址: http://www.djcxy.com/p/72756.html

上一篇: 自动释放池调试

下一篇: 使用Autorelease池和环境变量进行调试