gluNewQuadric 泄漏内存
当我使用 Instruments(X 代码工具,我在 Objective-C 中编程)检查我的应用程序是否存在泄漏时,我看到 #living“malloc 48 字节”分配变得越来越大。 另外,Instruments 确实说那里有泄漏。如果我检查负责任的呼叫者,它总是显示“gluNewQuadric”。 我上网查了一下,发现有些人有同样的抱怨,但不是太多,而且我也没有找到可行的解决方案。 我还放入
glutInit(&argc, argv);
了“main.m”,#living的增幅似乎有所下降,但仍在持续增长。 我使用 glu 的唯一地方是有关于
glutSolidSphere
glutWireSphere
如何解决这个问题的建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有一个建议:不要使用过多的渲染基元。它们是为了快速测试而不是为了严肃的业务。几周前,我发布了两个关于如何使用纯 OpenGL 绘制球体而不诉诸 GLU 或 GLUT 的冗长答案:
使用 Visual 在 Opengl 中创建 3D 球体C++
如何为曲线上的实心球体设置动画
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