Cocoa CGImageSourceRef memoryleak

Cocoa CGImageSourceRef memoryleak,cocoa,memory-leaks,cgimagesource,Cocoa,Memory Leaks,Cgimagesource,我正在使用带有ARC的XCode。 当我在循环中的许多图像上运行应用程序时,此代码会导致应用程序内存泄漏。 有人知道我做错了什么吗?围绕代码包装@autoreleasepool解决了这个问题。图像约为1.2MB NSDictionary* result = nil; CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)[self TIFFRepresentation], NULL); if ( N

我正在使用带有ARC的XCode。 当我在循环中的许多图像上运行应用程序时,此代码会导致应用程序内存泄漏。
有人知道我做错了什么吗?

围绕代码包装@autoreleasepool解决了这个问题。图像约为1.2MB

NSDictionary* result = nil;

CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)[self TIFFRepresentation], NULL);

if ( NULL == source )
{
}
else
{
    CFDictionaryRef metadataRef = CGImageSourceCopyPropertiesAtIndex (source, 0, NULL);
    if (metadataRef)
    {
        NSDictionary* immutableMetadata = (__bridge NSDictionary *)metadataRef;
        if (immutableMetadata)
        {
            result = [NSDictionary dictionaryWithDictionary : (__bridge NSDictionary *)metadataRef];
        }

        CFRelease(metadataRef);
        metadataRef = nil;
    }

    CFRelease(source);
    source = nil;
}

return result;