CGImage 泄漏,无论我如何 CGRelease
上下文是一个 Quartz Composer 插件,我想在其中创建一个相机框架之外的 CGImage。这是相关的代码
id<QCPlugInInputImageSource> inputImage_ = self.inputImage;
CGColorSpaceRef colorSpace = [inputImage_ imageColorSpace];
,稍后
dataProvider = CGDataProviderCreateWithData(NULL,
[inputImage_ bufferBaseAddress],
[inputImage_ bufferPixelsHigh] * [inputImage_ bufferBytesPerRow],
NULL);
cgImage = CGImageCreate(
[inputImage_ bufferPixelsWide],
[inputImage_ bufferPixelsHigh], 8,
(pixelFormat == QCPlugInPixelFormatI8 ? 8 : 32),
[inputImage_ bufferBytesPerRow], colorSpace,
(pixelFormat == QCPlugInPixelFormatI8 ? 0 :
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host),
dataProvider, NULL, false, kCGRenderingIntentDefault);
CGDataProviderRelease(dataProvider);
CGImageRelease(cgImage);
如果我删除 cgImage 创建和释放,我就没有泄漏。泄漏仅发生在 Quartz Composer 的预览模式下(这不是垃圾收集,这可能意味着什么)。 先感谢您
the context is a Quartz Composer plugin, in which I want to create a CGImage out of camera frame. This is the relevant code
id<QCPlugInInputImageSource> inputImage_ = self.inputImage;
CGColorSpaceRef colorSpace = [inputImage_ imageColorSpace];
and later
dataProvider = CGDataProviderCreateWithData(NULL,
[inputImage_ bufferBaseAddress],
[inputImage_ bufferPixelsHigh] * [inputImage_ bufferBytesPerRow],
NULL);
cgImage = CGImageCreate(
[inputImage_ bufferPixelsWide],
[inputImage_ bufferPixelsHigh], 8,
(pixelFormat == QCPlugInPixelFormatI8 ? 8 : 32),
[inputImage_ bufferBytesPerRow], colorSpace,
(pixelFormat == QCPlugInPixelFormatI8 ? 0 :
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host),
dataProvider, NULL, false, kCGRenderingIntentDefault);
CGDataProviderRelease(dataProvider);
CGImageRelease(cgImage);
If I remove the cgImage create and release I got no leak. The leak is only happening in Preview mode of Quartz Composer (which is not Garbage Collected, which could mean something).
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论