gluNewQuadric leaking memory
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开发者_Go百科 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?
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
精彩评论