Note that there are some explanatory texts on larger screens.

plurals
  1. PONSZombieEnabled prevents my app from crashing
    text
    copied!<p>So I've been debugging like a mad men using NSZombiesEnabled and NSZombies in Instruments. However when running the app using zombies it seems to resolve my issue. When I run the app without NSZombiesEnabled or NSZombies in instruments it crashes. Any idea on how to deal with this?</p> <p>So the issue is that I am releasing something twice, but can't seem to find where I am doing this. Turning on NSZombieEnabled won't help as the program runs fine without telling me where I am over releasing.</p> <p>So I think I kind of know where it's crashing, I have this globalArray Singleton class that I am creating:</p> <pre><code>extern NSString * const kClearDataSource; @interface AHImageDataSource : NSObject + (AHImageDataSource *)sharedDataSource; - (void) clearDataSource; - (void) addObject:(id) object; - (void) addObject:(id)object atIndex:(int) index; - (int) count; - (id) objectAtIndex:(int) index; @end NSString * const kClearDataSource = @"clearDataSource"; @interface AHImageDataSource() { NSMutableArray * imageDataSource_; } @property (nonatomic, retain) NSMutableArray * imageDataSource_; @end @implementation AHImageDataSource @synthesize imageDataSource_; + (AHImageDataSource *)sharedDataSource { static AHImageDataSource *_sharedClient = nil; static dispatch_once_t oncePredicate; dispatch_once(&amp;oncePredicate, ^{ _sharedClient = [[self alloc] init]; }); return _sharedClient; } - (id)init { self = [super init]; if (!self) { return nil; } NSMutableArray * temp = [[NSMutableArray alloc] initWithCapacity:200]; self.imageDataSource_ = temp; [temp release]; return self; } -(void) clearDataSource { if ([self.imageDataSource_ count] &gt; 0){ [self.imageDataSource_ removeAllObjects]; } } - (void) addObject:(id) object { [self.imageDataSource_ addObject:object]; } - (void) addObject:(id)object atIndex:(int) index { [self.imageDataSource_ insertObject:object atIndex:index]; } - (int) count { return [self.imageDataSource_ count]; } - (id) objectAtIndex:(int) index { if (index &gt;= 0 &amp;&amp; index &lt; [self.imageDataSource_ count]){ return [self.imageDataSource_ objectAtIndex:index]; } return nil; } - (void) dealloc { [super dealloc]; [imageDataSource_ release]; } @end </code></pre> <p>at one point of the code I am trying to remove all of the objects in the array and then adding some stuff in. When that happen the crashed happened.</p> <p>This part of the code crashes the second time it was executed:</p> <pre><code> NSArray *arr = [response valueForKey:@"data"]; if ([arr count] &gt; 0){ [[AHImageDataSource sharedDataSource] clearDataSource]; } for (NSDictionary * data in arr){ AHInstagramImageData * imgData = [[AHInstagramImageData alloc] initWithData:data]; [[AHImageDataSource sharedDataSource] addObject:imgData]; [imgData release]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload