开发者

release CCTextureCache?

开发者 https://www.devze.com 2023-04-04 20:22 出处:网络
i am probably have a memory leaks , my app is working great on one iphone, but on another one i allways get this error :

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 al开发者_如何学运维lways release it .

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

thanks alot


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消