Curnelious
Curnelious

Reputation: 1

release CCTextureCache?

i am probably have a memory leaks , my app is working great on one iphone, but on another one i allways get this error :

2011-09-15 07:20:34.478 BetaDoll[1334:707] cocos2d: deallocing <CCTextureCache = 00267990 | num of textures =  3 | keys: (
    "fur.png",
    "Closing_eyes.png",
    "regular.png"
)>
Program received signal:  “EXC_BAD_ACCESS”

now , when i use :

texture = [[CCTextureCache sharedTextureCache] addImage:[NSString stringWithFormat:@"%@.png", basic_pic]];

i am allways release it .

whats the problem here ? how should i release the texture cache anyway ? and when ??

thanks alot

Upvotes: 1

Views: 626

Answers (1)

Kazuki Sakamoto
Kazuki Sakamoto

Reputation: 13999

You can get rid of the texture cache as following.

[[CCDirector sharedDirector] purgeCachedData];

It will remove unused and cached textures.

BTW, you are releasing CCTextureCache instance.

cocos2d: deallocing <CCTextureCache

It might be caused by CCTextureCache +purgeSharedTextureCache method.

[CCTextureCache purgeSharedTextureCache];

You don't need to call this method.

Upvotes: 3

Related Questions