首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS内存警告中断EAGLView

iOS内存警告中断EAGLView
EN

Stack Overflow用户
提问于 2011-07-11 23:43:32
回答 1查看 814关注 0票数 1

当我得到一个内存警告级别-1,我的EAGLView开始吐出行openGL错误(502 & 506),应用程序没有崩溃,但EAGLView变得没有响应。错误是垃圾邮件,因为Cocos2d主任调用抽签。

内存警告回调是这样的:

代码语言:javascript
复制
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    [[CCDirector sharedDirector] purgeCachedData];
}

  1. 502和506错误意味着什么? 2.内存警告对opengl视图有什么影响,还是在我的代码中发布了它不应该发布的内容?

更新

设法从cocos2d中获取一些详细的日志:

代码语言:javascript
复制
Received memory warning. Level=1
cocos2d: deallocing <CCSprite = 002657B0 | Rect = (0.00,0.00,32.00,32.00) | tag = -1 | atlasIndex = -1>
cocos2d: deallocing <CCTexture2D = 00265EA0 | Name = 4 | Dimensions = 32x32 | Coordinates = (1.00, 1.00)>
cocos2d: deallocing <CCSprite = 00265A70 | Rect = (0.00,0.00,32.00,32.00) | tag = -1 | atlasIndex = -1>
cocos2d: deallocing <CCSprite = 00266050 | Rect = (0.00,0.00,32.00,32.00) | tag = -1 | atlasIndex = -1>
cocos2d: deallocing <LineNode = 0027A630 | Tag = -1>
cocos2d: deallocing <LineNode = 0027AB90 | Tag = -1>
cocos2d: deallocing <LineNode = 0027AF50 | Tag = -1>
cocos2d: deallocing <LineNode = 0027B270 | Tag = -1>
cocos2d: deallocing <LineNode = 00204820 | Tag = -1>
cocos2d: deallocing <PaintingView = 00264970 | Tag = -1>
cocos2d: deallocing <TutorialView = 00266570 | Tag = -1>
cocos2d: deallocing <CCRenderTexture = 00266660 | Tag = -1>
cocos2d: deallocing <CCTexture2D = 00266750 | Name = 5 | Dimensions = 1024x1024 | Coordinates = (1.00, 0.75)>
cocos2d: deallocing <CCSprite = 00266960 | Rect = (0.00,0.00,1024.00,768.00) | tag = -1 | atlasIndex = -1>
cocos2d: deallocing <EAGLView: 0x24aee0; frame = (0 0; 1024 768); transform = [0, -1, 1, 0, 0, 0]; autoresize = RM+BM; layer = <CAEAGLLayer: 0x2492c0>>
cocos2d: deallocing <ES1Renderer = 0024D0E0 | size = 768x1024>
modifying layer that is being finalized - 0x2fab80

所以这差不多就是一切了。看上去除了现场节点外,一切都在消失。

EN

回答 1

Stack Overflow用户

发布于 2011-07-12 00:40:58

至于OpenGL错误意味着什么,您可以参考您的OpenGL头,这将告诉您502是GL_INVALID_OPERATION,506是GL_INVALID_FRAMEBUFFER_OPERATION

我从您的问题或提供的代码中看不到任何东西,但我假设您是过早地释放了框架缓冲区(您可能不应该在运行时这样做),或者Cocos2D在调用purgeCachedData (我对后者有点怀疑)时正在释放框架缓冲区,并且没有完全重新创建它(如果有的话)。您可能需要检查EAGLView的实现,看看它是否设置为在需要时处理重新创建框架缓冲区(并查看是否存在不必要的释放框架缓冲区的地方)。

也就是说,如果您收到了内存警告,您可能也想要处理这些警告的来源。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6658017

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档