Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 内存泄漏:CGDataProviderCreateWithCopyOfData_Ios - Fatal编程技术网

Ios 内存泄漏:CGDataProviderCreateWithCopyOfData

Ios 内存泄漏:CGDataProviderCreateWithCopyOfData,ios,Ios,我使用UIImage+Resize库在拍摄图像后直接调整图像大小 我确实收到了以下代码的内存泄漏: CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, srcSize.width, srcSize.height), imgRef); UIImage* resizedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageConte

我使用UIImage+Resize库在拍摄图像后直接调整图像大小

我确实收到了以下代码的内存泄漏:

CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, srcSize.width, srcSize.height), imgRef);
UIImage* resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGDataProviderCreateWithCopyOfInstruments中的数据内存泄漏


我试着像其他StackOverflow帖子一样将其添加到@autoreleasepool中。

注意:您可能已经解决了您的问题,这个答案适用于将来有同样问题的读者

我已经了解了我自己的实现(使用GPUImage进行视频分析)的情况

我需要在调用
CGBitmapContextCreateImage
调用者(它还调用
CGDataProviderCreateWithCopyOfData
)时添加一个
autoreleasepool
闭包


所有的
CGDataProviderCreateWithCopyOfData
意味着你泄漏的东西是图像,这就是你创建图像的地方。这完全取决于您在其他地方如何使用
resizedImage
。仪器不能告诉你错误在哪里。它告诉你内存分配的位置。你发现你的代码有什么问题吗?我也有同样的问题。
    func run() {
        while (parent != nil) {
            if semaphore.acquireSemaphore(5000) {
                autoreleasepool { // Without this I was leaking images until crash.
                    parent?.analyseImage(self.sampleBuffer!, lineFinder:finder) //This calls CGBitmapContextCreateImage
                }
            }
        }
        thread = nil
    }