Extending NSData and (not) overriding dealloc
[]
The Atomic Birdhouse
Given NSString *path pointing to a file, you could create an NSData with almost no memory hit regardless of file size by creating it as: When you create a memory mapped file, the operating system gives you a memory pointer that you can use to access the file’s data. Using the deallocation block scheme I can add a block calling munmap(2) to my NSData object by adding this code right after I create it: