Susitha
Susitha

Reputation: 3349

How to get rid of memory warnings with cocos2d and cocosbuilder

I am working on an animation app, That used cocosbulder files. I am adding scenes by,

[[CCDirector sharedDirector] replaceScene:[CCTransitionCrossFade transitionWithDuration:0.5f scene:[CCBReader sceneWithNodeGraphFromFile:@"SongLoadingScene.ccbi"] ]];

It is generate memory warnings in iPad1.I have try some codes in dealloc() in each scene.

 -(void)dealloc{

[[CCSpriteFrameCache sharedSpriteFrameCache] removeSpriteFrames];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeUnusedSpriteFrames];
[[CCTextureCache sharedTextureCache] removeUnusedTextures];
[[CCTextureCache sharedTextureCache] removeAllTextures];
[[CCDirector sharedDirector] purgeCachedData];

[super dealloc];
}

It doesn't work. After 5 to 7 scenes loaded, app get memory warnings and crashing happens. It uses about 500Mb when the crashing happens. How can i get rid of this.

Upvotes: 0

Views: 171

Answers (0)

Related Questions