gluNewQuadric leaking memory

血红的双手。 提交于 2019-12-12 04:20:44

问题


When I checked my Application for leak with Instruments (X-Code Tool, I program in objective-c), I saw the #living "malloc 48 bytes" allocations growing bigger and bigger. Also, Instruments does say that it leaks there. If I check for the Responsible caller, it always says "gluNewQuadric". I checked the internet for a bit and found some people are having the same complaints, but not too many, and I also found no working solution. I also put

glutInit(&argc, argv);

in "main.m", and the increase of #living seems to have gone down a bit, but is still growing persistently. The only place where I use glu is with

glutSolidSphere
glutWireSphere

Any suggestions on how to fix this?


回答1:


Here's a pro-tipp: Don't use GLUT rendering primitives. They are there for quick testing and not meant for serious bussines. A few weeks ago I posted two lengthy answers on how to draw a sphere using pure OpenGL without resorting to GLU or GLUT:

  • Creating a 3D sphere in Opengl using Visual C++

  • How to animate a solid sphere over a curve



来源:https://stackoverflow.com/questions/6663300/glunewquadric-leaking-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!