开发者

Must I release the OpenAL context here?

When setting up OpenAL, the Leaks Instruments tells me that I am leaking alContext here:

alDevice = alcOpenDevice(NULL);
if (!alDevice) {
    return NO;
}

alContext = a开发者_开发问答lcCreateContext(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?


Here's how you would cleanup:

alcMakeContextCurrent(NULL);
alcDestroyContext(alContext);
alcCloseDevice(alDevice);

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜