title: Virtual Memory Usage from Java under Linux, too much memory used
body: <p>I have a problem with a Java application running under Linux.</p>
  
  <p>When I launch the application, using the default maximum heap size (64 MB), I see using the tops application that 240 MB of virtual Memory are allocated to the application.  This creates some issues with some other software on the computer, which is relatively resource-limited.</p>
  
  <p>The reserved virtual memory will not be used anyway, as far as I understand, because once we reach the heap limit an <code>OutOfMemoryError</code> is thrown.  I ran the same application under windows and I see that the Virtual Memory size and the Heap size are similar.</p>
  
  <p>Is there anyway that I can configure the Virtual Memory in use for a Java process under Linux?</p>
  
  <p><strong>Edit 1</strong>: The problem is not the Heap.  The problem is that if I set a Heap of 128 MB, for example, still Linux allocates 210 MB of Virtual Memory, which is not needed, ever.**</p>
  
  <p><strong>Edit 2</strong>: Using <code>ulimit -v</code> allows limiting the amount of virtual memory.  If the size set is below 204 MB, then the application won't run even though it doesn't need 204 MB, only 64 MB.  So I want to understand why Java requires so much virtual memory.  Can this be changed?</p>
  
  <p><strong>Edit 3</strong>: There are several other applications running in the system, which is embedded. And the system does have a virtual memory limit (from comments, important detail).</p>