title: Memory-mapped files and low-memory scenarios
body: <p>How does the iOS platform handle memory-mapped files during low-memory scenarios? By low-memory scenarios, I mean when the OS sends the <code>UIApplicationDidReceiveMemoryWarningNotification</code> notification to all observers in the application.</p>
  
  <p>Our files are mapped into memory using <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html" rel="noreferrer"><code>+[NSData dataWithContentsOfMappedFile:]</code></a>, the documentation for which states:</p>
  
  <blockquote>
    <p>A mapped file uses virtual memory techniques to avoid copying pages of the file into memory until they are actually needed.</p>
  </blockquote>
  
  <p>Does this mean that the OS will also unmap the pages when they're no longer in use? Is it possible to mark pages as being no longer in use? This data is read-only, if that changes the scenario. How about if we were to use <code>mmap()</code> directly? Would this be preferable?</p>