title: Contigious Pages/Physical Memory in Java
body: <p>My goal is to ensure that an array allocated in java is allocated across contiguous physical memory. The issue that I've run into is that the pages an array is allocated across tend not to be contiguous in physical memory, unless I allocate a really large array.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li>Why does a really large array ensure
  pages which are contiguous in physical memory?</li>
  <li>Is there any way to ensure an array is allocated across physical memory, that doesn't involve making the array really large?</li>
  <li>How can I tell what page or physical address a Java object/array exists in, without measuring cache hits/cache misses?</li>
  </ul>
  
  <p>I'm not looking for answers asking why I am doing this in java. I understand that C would "solve my problem", and that I'm going against the fundamental nature of java. Nevertheless I have a good reason for doing this.</p>
  
  <p>The answers need not be guaranteed to work all the time. I am looking for answers that work most of the time. Extra points for creative, out-of-the-box answers that no reasonable Java programmer would ever write. It's OK to be platform specific(x86 32-bit 64-bit). </p>