Questions tagged [nszombie]

NSZombie is an Apple OS-specific (OSX and iOS) tool for debugging issues with reference-counting.

NSZombie is an Apple OS-specific (OSX and iOS) tool for debugging issues with reference-counted objects. In particular, it helps you track down objects that are over-released by recording a history of all -retain and -release messages sent to all objects created during execution.

When NSZombie is enabled, unbalanced -retain and -release messages cause the application to immediately halt and break into the debugger. This allows you to examine the problematic message to determine if there is an extraneous -release (or -autorelease), or a missing -retain.

Resources

223 questions
3
votes
1 answer

XCode - iPhone SDK Zombies

Is NSZombiesEnabled supported when debugging applications built with a target of the iPhone SDK 3.x? Also if it is supported, is there anywhere I can get a list of the possible levels supported?
Mick Walker
  • 3,862
  • 6
  • 47
  • 72
3
votes
2 answers

NSZombie - should retain/release calls be paired by library?

TL:DR version: I used NSZombieEnabled to find source of EXC_BAD_ACCESS error and saw a library has 1 more release than retains. Can I assume that this library is causing the crash or can that release be associated with a retain from another…
johnyu
  • 2,152
  • 1
  • 15
  • 33
3
votes
1 answer

Strange "zombie" in forwardInvocation: + getArgument:atIndex methods

Here is part from my code: - (void)viewDidLoad { [super viewDidLoad]; CGRect frame = [[UIScreen mainScreen] bounds]; _webView = [[UIWebView alloc] initWithFrame:frame]; [_webView setHidden:NO]; [self.view addSubview:_webView]; …
3
votes
0 answers

message sent to deallocated instance

After more than one day reading questions and trying to apply answers, I must ask more help. My ios6 app has a table view on the main screen. After selecting a cell, we access a view controller with a UINavigationBar which has a custom "Back" button…
Nanego
  • 1,890
  • 16
  • 30
3
votes
1 answer

Objective-C: why a custom object will be a zombie

I'm developing an app in Objective-C using ARC. My simplified code looks like this: ClassA (.m) MyCustomClass *obj = [[MyCustomClass alloc] initWithValue1:@"abc" value2:1000]; MyViewController *vc = [[MyViewController alloc] initWithObject:obj]; //…
3
votes
3 answers

blocks and async callback, dealloc object - need to nil the block

There is a similar question here, which doesn't explain exactly what I want: Objective C Blocks as Async-callbacks & BAD ACCESS I have a view controller, which calls a service with an async callback. The callback is done using a block, which…
bandejapaisa
  • 26,576
  • 13
  • 94
  • 112
3
votes
1 answer

Zombie option missing from both diagnostics and instruments

Running Xcode 4.0.2, the Zombie option is missing, from both places where other SO posts have suggested to find it. Product > Run... looks like this: Product > Profile looks like this: What is strange is that I have used Zombies before in this…
Wienke
  • 3,723
  • 27
  • 40
2
votes
0 answers

NSZombie created with -Os and Automatic Reference Counting in iOS 5 development

I spent the day working on a strange error in my iOS 5 iPad application, and I was wondering if anyone had some information. Here's the general setup: There's a UIViewController subclass StoryViewChildController that has two member variables:…
erlloyd
  • 485
  • 6
  • 20
2
votes
0 answers

ARC with zombies - Why do objects in instance variables not get released when owning object is deallocated?

Possible Duplicate: Why is object not dealloc'ed when using ARC + NSZombieEnabled In a project using ARC with zombie objects enabled, if an object holds a strong reference to another object when it is deallocated, that other object does not get…
GBegen
  • 6,107
  • 3
  • 31
  • 52
2
votes
2 answers

Retained property being deallocated

I am fairly new with Objective-C memory management and although I thought I understood it, I have a problem that I cannot manage to solve. I have this property: @property (nonatomic, retain) NSDate *dateDisplayed; that I assign in my viewDidLoad…
chopchop
  • 1,905
  • 2
  • 22
  • 37
2
votes
3 answers

-[CALayer release]: message sent to deallocated instance

I'm having a problem with some code in the loadView: method of one of my view controllers. Essentially I have a view which centres itself in a larger view (on an iPad) and has some labels, buttons and icons which are programmatically loaded into…
Daniel Farrelly
  • 195
  • 3
  • 12
2
votes
1 answer

iOS 14 crash zombie when use dispatch_semaphore

I handle some old code, it runs well, but now crash only on ios 14 here is the demo static NSData *DownloadWithRange(NSURL *URL, NSError *__autoreleasing *error) { NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL]; …
John Shaw
  • 21
  • 1
2
votes
2 answers

Objective C: How to tell if an object is NSZombie now

I have NSZombieEnabled=YES set, and I want to do the following code - (NSString*) udid { if (udid == nil) { udid = [[UIDevice currentDevice] uniqueIdentifier]; NSLog(@"UDID=%@", udid); } return udid; } it turns out…
Zhao Xiang
  • 1,625
  • 2
  • 23
  • 40
2
votes
1 answer

Objective C: Where to find in gdb?

I am trying to debug my program using NSZombie. The debugger did return me the address of the instance with the issue, however I am not sure where to obtain the pid which is required to run the command 'shell malloc_history Can anyone advise me on…
Zhen
  • 12,361
  • 38
  • 122
  • 199
2
votes
1 answer

large CFString allocations when running under Zombies instrument but not leaks or allocations instrument

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…
Matt
  • 4,253
  • 1
  • 27
  • 29