Hi,
I am writing the code using cocos2d.
I want to release all the memory I allocated. I have done it in dealloc method in the following way.
All the objects I released are declared in interface file and property (assign) was set and are synthesized in implementation file.
I used alloc method to create them like
self.PlayerA = [[CCSprite alloc] initWithFile:@" PlayerImage_01.png"];
-(void)dealloc
{
int count , i ;
count = [self.PlayerA retainCount];
for(i = 0; i < count; i++)
[self.PlayerA release];
count = [self.targetLayer retainCount];
for(i = 0; i < count; i++)
[self.targetLayer release];
count = [self.playerGunSlowDrawSheet retainCount];
for(i = 0; i < count; i++)
[self.playerGunSlowDrawSheet release];
count = [self.playerGunSlowDrawAnimation retainCount];
for(i = 0; i < count; i++)
[self.playerGunSlowDrawAnimation release];
count = [self.numberFinishedTime retainCount];
for(i = 0; i < count; i++)
[self.numberFinishedTime release];
count = [self.backGroundImage retainCount];
for(i = 0; i < count; i++)
[self.backGroundImage release];
[[CCTextureCache sharedTextureCache] removeAllTextures];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeSpriteFrames];
[super dealloc];
}
But I am getting: Program received signal: “EXC_BAD_ACCESS”. I debugger it is showing the error at [super dealloc];
Am I totally wrong in the memory management ? Or am I missing anything in this. Thank you.