我必须在这里释放 OpenAL 上下文吗?
设置 OpenAL 时,Leaks Instruments 告诉我,我在此处泄漏 alContext:
alDevice = alcOpenDevice(NULL);
if (!alDevice) {
return NO;
}
alContext = alcCreateContext(alDevice, 0); // leaking!
if (!alContext) {
return NO;
}
BOOL success = alcMakeContextCurrent(alContext);
if (!success) {
return NO;
}
return YES;
我应该在哪里以及如何释放 alContext?
When setting up OpenAL, the Leaks Instruments tells me that I am leaking alContext here:
alDevice = alcOpenDevice(NULL);
if (!alDevice) {
return NO;
}
alContext = alcCreateContext(alDevice, 0); // leaking!
if (!alContext) {
return NO;
}
BOOL success = alcMakeContextCurrent(alContext);
if (!success) {
return NO;
}
return YES;
Where and how should I release the alContext?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是清理的方法:
每当您完成上下文时,您只需调用这些方法...这取决于您的应用程序以及您如何使用它,但可能在某个
dealloc
中。Here's how you would cleanup:
And you would just call these methods whenever you are done with the context... that depends on your application and how you are using it, but probably in a
dealloc
somewhere.