HI ,As a Beginner I want to know NSZombie, Could anybody please explain the use of NSZombie,with some sample code? how it handles the crash,In what way it funtioning, Thanks In Advance
Asked
Active
Viewed 320 times
-1
-
There are quiet a few existing questions about it right here on StackOverflow. Try these our for starts: http://stackoverflow.com/questions/4168327/what-is-nszombie http://stackoverflow.com/questions/5386160/how-to-enable-nszombie-in-xcode – Rony Rozen Jul 20 '14 at 14:18
1 Answers
0
NSZombie
causes objects to remain in memory after they've otherwise been deallocated. Instead of being deallocated, they are marked as zombies and raise an exception if anybody calls them. So in the pre-ARC world if you did this:
NSString *someString = [[NSString alloc] initWithString:@"String to copy"];
[someString release];
NSLog(@"%@", someString);
Then an exception would be raised by the log, and you'd immediately know who is making an invalid call. The risk without zombies is that some other object — possibly some other string — will receive the same memory storage as someString
had and your calls may not malfunction at all or may have any other undefined result.
To run with zombies enabled just edit your project target and tick 'Enable Zombie Objects'.

Tommy
- 99,986
- 12
- 185
- 204