Docker container: Memory consumption issue


We are using docker for our dhis2 implementations. We have noticed that the web/tomcat container doesn’t releases the memory dynamically once the usage is completed.

I have set the following JVM parameters for the tomcat container,
JAVA_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -Xms512m -Xmx4096m -XX:-UseGCOverheadLimit -XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10

Any suggestions on this? how to define release of memory (RAM) dynamically?

Many thanks in advance.


Hey @Mohammad_Ullah,

Did you find a solution to your issue yet?

If not, what is the java version you are using? Jvm prefers taking more memory than it needs to, but that behaviour should have been improved in java 12. Do you experience any problems with the memory consumption? Does your container crash at any point? There are couple of additional flags you can try: -XX:+UseContainerSupport, -XX:+UseCGroupMemoryLimitForHeap.


Hi @Gintare,

Thank you so much for your response. We are using java 1.8 and now testing with different versions of java, tomcat etc. The container doesn’t crash but keeps occupying the memory even after the job (i. e import/export etc) is done.

Will share if adding those additional flag solve the problem.

Thank you again.

1 Like