When I run Clath Static Analyzer against the code that I converted to use ARC, it tells NSNumber in this code block as a leak:
NSNumber *temporaryNumber = [NSNumber numberWithFloat:0.85]; CFNumberRef compressionQuality = CFBridgingRetain(temporaryNumber); CFDictionarySetValue(snapshotMetaAndOpts, kCGImageDestinationLossyCompressionQuality, compressionQuality); CFRelease(compressionQuality);
The analyzer indicates that the NSNumber created and stored in the temporary number ends with a +1 after all of this is completed and therefore leaks. I know that I could just as easily do
CFDictionarySetValue(snapshotMetaAndOpts, kCGImageDestinationLossyCompressionQuality, (__bridge CFNumberRef)[NSNumber numberWithFloat:0.85]);
but I'm still trying to understand the exact actions of the bridge in ARC, so I'm trying to figure out the above. The actual analyzer output is as follows:

The way I read CFBridgingRetain() and __bridge_retained is that they transfer ownership of the ARC-managed NSObject to the Core Foundation, increasing the number of deductions by 1. I balance this with the corresponding CFRelease() . I expected that NSNumber would be created as an object with auto-implementation and therefore would be completely balanced by the ARC.
Similarly, if I do the following using a simple __bridge cast:
NSNumber *temporaryNumber = [NSNumber numberWithFloat:0.85]; CFNumberRef compressionQuality = (__bridge CFNumberRef)temporaryNumber; CFDictionarySetValue(snapshotMetaAndOpts, kCGImageDestinationLossyCompressionQuality, compressionQuality); CFRelease(compressionQuality);
A static analyzer gives this a clean health score.
Am I misinterpreting something in the sense that objects do not have bridges, or is this a mistake in a static analyzer?