My app crash because a lot of CCSprite 2D i release it but it doesn't work

i don’t know why the release of the CCSpriteFrameCache doesn’t work properly.

thanks for the help


escena_0.cpp.zip (3.4 KB)

Hola Santiago,

That code is totally wrong. You should never use a “new” with CCObjects. You should use its static constructor. CCSprite::create(…)

Best,

JB

He does init his CCObjects and releases them in dtor so no problem here.

Thanks for the answers, the problem isn’t fixed yet, i don’t know why, my question is ¿does cocos2d-x have some limitations about sprites or weight?, because i have 6 png with his plist, each one size is 4800x4800 i render all at the same time and it makes my app shut down. I am making an app for ipad with retina display.

thanks for the help

you should create different forum posts for different questions

i know it’s about differents topics but it’s about the same problem, i dont know why my app crashes so i’m discarding what could be the problem, Jesus i did what u told me in the previous comment, but the problem continues, can you check it again and tell me what may be the problem. the .cpp is attached,

i am gonna created the new post with the sprites weight topic

thanks

hi, an approach would be to simplify the scenario as much as possible, so try to use a reduced version of your assets…

i use 6 texture atlas with size 4800 x 4800 for generate the animations with this code i run the animations

this~~>ricky= CCSprite::create;
CCArray* animFrames = CCArray::createWithCapacity;
for
{
//print the frame that is currently charged
sprintf;
CCLog;
CCSpriteFrame* frame = this~~>cache_ricky~~>spriteFrameByName;
animFrames~~>addObject(frame);
}
//save the sequence of frames in this animation.
CCAnimation *animation = CCAnimation::createWithSpriteFrames(animFrames,0.04f);

for sprite i repeat this code until the animation is complete then i run the animation.

this~~>ricky~~>runAction(CCSequence::create( CCAnimate::create(animation),CCAnimate::create(animation1) ,CCAnimate::create(animation2),CCDelayTime::create(3.0),CCAnimate::create(todos_1_ricky),CCAnimate::create(todos_2_ricky),CCDelayTime::create(3.0),CCAnimate::create(animation3),CCAnimate::create(animation4),CCCallFunc::create(this, callfunc_selector(escena_0::loop_ricky)), NULL));

next i remove it from the cache
cache_ricky~~>removeSpriteFramesFromFile;
CCTextureCache::sharedTextureCache~~>removeTextureForKey;
cache_ricky~~>removeSpriteFramesFromFile;
CCTextureCache::sharedTextureCache~~>removeTextureForKey;
cache_ricky~~>removeSpriteFramesFromFile;
CCTextureCache::sharedTextureCache~~>removeTextureForKey;
cache_ricky~~>removeSpriteFramesFromFile;
CCTextureCache::sharedTextureCache~~>removeTextureForKey;
i use 4 sprites in this scene when all the animation is done i remove all the texture in case i forgot any.
this~~>cache_ricky~~>sharedSpriteFrameCache()>removeSpriteFrames;
CCTextureCache::purgeSharedTextureCache;
this
>cache_ricky->removeUnusedSpriteFrames();
CCTextureCache::sharedTextureCache()->removeAllTextures();

the game compiles perfectly but when is running crashes an shut down, i dont use new objects, or if i use i release it, when i dont add one of the sprites to the scene is go very well, i mean only use 3 sprites of the 4 i had.

yo no se si es por peso o si cocos2d-x tiene limitaciones thanks for the answer.

sorry for the spanglish jajajajajaja

this is the part in spanish
** I do not know if it’s weight or if cocos2d-x has limitations

thanks for the answer

cocos2dx does not limit texture sizes. the hardware does it.

As I said, scale down the spritesheets and you will discard this possibility

I notice that for iPhone and iPad, the largest possible size is 2048x2048. For iPhone Retina and iPad Retina, the largest is 4096x4096. Using larger sizes will make your app crash.