title: Default Java Heap Size and Memory Issues it can cause
body: <p>I have an application whose backend is built on Java 8. Recently I've been seeing that the application restarts by itself, because of OOM. I got to know its because of OOM, by looking at the exit status of the Docker Container. There was no <code>Xmx</code> and <code>Xms</code> values configured for the system and as such it should be using the default heap size, which in case of my server which has 4 gigs of memory should be around 512 MB (I read in some SO answers that deafult heap max size is 1/8th the memory present). After setting the <code>Xms</code> and <code>Xmx</code> values my app now is behaving correctly without any restarts. I also tried increasing the memory in the server to 7 gigs before setting the <code>Xmx</code> and <code>Xms</code> values, but it also didn't help. What i want to know is that, how come the system was going OOM, when there was sufficient memory available for the application.<br>
  Does the default heap size extend itself if memory requirement increases for the app ? If memory was getting full, why was GC not getting triggered ? </p>