I\'m building a photo book layout application. The application frequently decompresses JPEG images into in-memory bitmap buffers. The size of the images is constrained to 10
initWithBytes:length:
tries to allocate its entire length in active memory, essentially equivalent to malloc()
of that size. If the length exceeds available memory, you will get nil. If you want to use large files with NSData
, I'd recommend initWithContentsOfMappedFile:
or similar initializers, as they use the VM system to pull parts of the file in and out of active memory when needed.