Java -Xmx option on Linux not limiting memory consumption
<p>Using Oracle Java 1.7.0_05 on Ubuntu Linux 3.2.0-25-virtual, on an amazon EC2 instance having 7.5 GB of memory, we start three instances of java, each using the switch -Xmx 2000m. </p>

<p>We use the default Ubuntu EC2 AMI configuration of no swap space.</p>

<p>After running these instances for some weeks, one of them freezes -- possibly out of memory. But my question isn't about finding our memory leak.</p>

<p>When we try to restart the app, java gives us a message that it cannot allocate the 2000 mb of memory. We solved the problem by rebooting the server.</p>

<p>In other words, 2000 + 2000 + 2000 > 7500?</p>

<p>We have seen this issue twice, and I'm sorry to report we don't have good diagnostics. How could we run out of space with only two remaining java processes each using a max of 2000 mb? How should we proceed to diagnose this problem the next time it occurs? I wish I had a "free -h" output, taken while we cannot start the program, to show here.</p>

<p>TIA.</p>
