title: What does it mean that "the memory requested by JVM from the OS has to be contiguous"?
body: <p>I've seen many people on the web claiming that "the JVM requests a contiguous unfragmented block of memory from the OS when it starts".
  What I can't understand is how this correlates with the notion of virtual memory.</p>
  
  <p>OS might swap out any process's memory pages to disk, then load them again into RAM - chances are they will be loaded into different locations, so physical memory used by the process will no longer be contiguous.</p>
  
  <p>As for the process's virtual memory - that will always be "contiguous" from the process's point of view, as each process has its own address space.</p>
  
  <p>Thus, what I'd like to understand is:</p>
  
  <ul>
  <li>Is the statement that memory allocated by OS to a JVM has to be<br>
  contiguous really true?</li>
  <li>If so, how does OS ensure memory stays contiguous considering it
  might be swapped out to disk and swapped in back to RAM?</li>
  <li>If the statement it not true, what might be the reasons why OS<br>
  would deny the process the virtual memory it asks for? Memory<br>
  overcommitting settings?</li>
  </ul>