Default value for kCGImageSource ShouldCache

There's an interesting conflict between the iOS docs and the iOS headers.

The docs say: kCGImageSourceShouldCache-docs

The header, however, says

/* Specifies whether the image should be cached in a decoded form. The
 * value of this key must be a CFBooleanRef.
 * kCFBooleanFalse indicates no caching, kCFBooleanTrue indicates caching.
 * For 64-bit architectures, the default is kCFBooleanTrue, for 32-bit the default is kCFBooleanFalse.
 */

IMAGEIO_EXTERN const CFStringRef kCGImageSourceShouldCache  IMAGEIO_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0);

To summarise - the docs say that the default value is True on 32 bit, false on 64 bit. The header says exactly the opposite - False on 32 bit, True on 64 bit.

To settle the disagreement, I wrote a short test where I checked the memory usage before and after calling CGImageSourceCreateThumbnailAtIndex. I modified the value of kCGImageSourceShouldCache passed in as an option, and I ran the test on both 32 bit and 64 bit devices, all on iOS 7.1.1 or 7.1.2.

This demonstrated a clear increase in memory usage (I used an 80MB image) when kCGImageSourceShouldCache was True.

I then ran the test again, but without specifying the value of kCGImageSourceShouldCache - so it picked up the default.

The results were clear - the default value of kCGImageSourceShouldCache on iOS 7, on both 32-bit and 64-bit systems, is False. Both the docs and the header are wrong.