glDrawElements上的奇怪崩溃[EXC _ ??? (11)(代码= 0,子代码= 0x0)]

时间:2013-05-27 09:11:14

标签: ios objective-c opengl-es

我的应用程序运行得很好,但大约3分钟后我发现了一个看起来像这样的奇怪崩溃

enter image description here enter image description here

以前有人经历过这样的事情并且知道可能是什么原因?这可能是某种内存泄漏吗?

一些代码:

- (void) draw {
[EAGLContext setCurrentContext:context];
glBindVertexArrayOES(_vertexArray);
shader.modelViewMatrix = mvm;
[shader texture:texture];
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
glBindVertexArrayOES(0);
}

- (void) texture: (int) tex {

glUseProgram(TextureShader);
_camModelViewMatrix = GLKMatrix4Multiply(_cameraMatrix, _modelViewMatrix);
_modelViewProjectionMatrix = GLKMatrix4Multiply(_projectionMatrix, _camModelViewMatrix);
glUniformMatrix4fv(mvp, 1, 0, _modelViewProjectionMatrix.m);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textures[tex]);
}

如果您需要查看任何其他代码,请告诉我

1 个答案:

答案 0 :(得分:0)

我还没有找到关于EXC的好文档_ ???异常,但我的理解是该线程已经消耗CPU太长时间了。我发现这个问题的最佳解释是关于stackoverflow的另一个问题:GCD crashes with any task longer than 255 seconds。编写长测试用例时遇到了这个问题,我通过将它们分解成更小的测试用例或用EXC _ ???来提高测试用例的性能来修复它们。当EXC _ ???看看堆栈是值得的。发生并考虑是否可以改进路径。