Hi, i'm using cocos2d on my game, which consists of many scenes that changes very often (it is a quiz game, and every quiz "question" is a scene, so i replaceScene in the directory every time the user answer a question.
In my scene class, in the init, i set the background image (the same for all questions):
backgroundLayer = [CCLayer node];
[self addChild: backgroundLayer];
bg01 = [CCSprite spriteWithFile:@"background_03.png"];
bg01.position = ccp(240,160);
[backgroundLayer addChild: bg01];
THE PROBLEM: the game goes Out of memory soon when i play a little, and analyzing the memory usage with Instruments Xcode tool i see that every time i replace the scene with another one the memory used by the game increases by about 1 MB !!. I saw for memory leaks, but i cannot find any made by me.
I also tried to comment the three lines about which load the background sprite and adds to the backgroundLayer, and without this the memory increases in each scene is very few (only about 150-200 kb per scene).
So it seems that for some reason that background image is loaded in memory but it is not freed, i also tried to call [[CCTextureCache sharedTextureCache] removeAllTextures] on the OnExit of each Scene, but this doesn't help to free memory.
Using Cocos2D 0.99.4, trying on iPad (even if it is an iPhone game, but i've no iphone actually).
Any ideas ?
Please help me, i'm going crazy....! :)
Thank you very much!