The Cocos2D framework caches a lot of objects in memory like Textures, Sprites etc. to application increase performance by avoiding repititive loading overheads.
When the device is about to run out of memory the iOS would invoke the applicationDidReceiveMemoryWarning handler. It is then we can invoke the following methods on the Cocos2D framework to purge/remove the cache data as follows:
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
[[CCTextureCache sharedTextureCache] removeUnusedTextures];
[[CCDirector sharedDirector] purgeCachedData];