title: Tomcat get killed by docker container due to memory outage
body: <p>I'm recently developing a rest service with tomcat. I set JAVA_OPTS = -Xmx1648m -Xmn1648 -server and make sure they already take effect. The docker is running with memory limit set to 4g.</p>
  
  <p>The observation is that the memory usage by the tomcat process keeps growing, eventually to 4g. Then, the memory cost stays between 99% ~ 100% for time randomly between several minutes to hours. Then, the tomcat process crashes without any error like jvm heap oom. </p>
  
  <p>I used jmap to dump the heap when the memory consumption observed by docker stats is around 3.5g. The dump file size is below 400m. Using mat to analyze the dump file shows most memory fraction actually could be garbage collected. I also manually run jcmd pid GC.run which largely reduced the memory usage (from 2g to 1.4g). </p>
  
  <p>My inspection is that tomcat never reached the limit set by jvm, otherwise, there should be error log about jvm heap oom. Then, the memory should be consumed by jvm or other threads within tomcat. But I couldn't find a way to fix this problem. Please help!</p>