Dmitry
Dmitry

Reputation: 1041

CCSprite memory overflow

I need to create and show 10 images using cocos2d. Each will be placed above previous one and all will be visible simultaneously (all of them has transparent areas). Each image has resolution 2048x1536.

When I create 5 or less CCSprites the app run fine, but when I create 6 CCSprite - it crashes on device (iPad) with error "Data Formatters temporary unavailable".

I suppose it's lack of memory, but maybe someone knows any approach for for this situation

Thanks!

Upvotes: 0

Views: 163

Answers (1)

Bastian
Bastian

Reputation: 10433

A transparent image of this size uses about 12mb ram (2048*1536*4 bytes).

You are lucky that you get 5 images of this size shown before your app crashes.. which usually happens at about 50mb ram usage.

Without more knowledge about what you want to do or need to display I can't give any advice what to do .. but you won't be able to show 10 images of this size.

edit: since you are using cocos/opengl you might be able to get more images shown by changing the image format to rgb4444. This will cut the memory need to the half but you also loose much quality on your images.

Upvotes: 1

Related Questions