title: Memory usage of FileChannel#map
body: <p>Does <a href="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#map(java.nio.channels.FileChannel.MapMode,%20long,%20long)" rel="noreferrer"><code>FileChannel#map</code></a> allocate all the memory needed for the resulting <code>ByteBuffer</code> immediately, or is it only allocated on-demand during reads from the buffer?</p>
  
  <p>I just tried mapping all of a 500+ MB file in a trivial test program, and looked at the memory usage of the process. (Using both <code>Runtime#totalMemory</code> and eyeballing it in the OS X Activity Monitor for a groovysh process.) The memory usage never passed 30-ish MB.</p>
  
  <p>So, could a Java implementation "hide" some of its memory usage in native calls? And if so, is there a way to find out how much that is on OS X?</p>