简体   繁体   中英

How to reduce committed heap memory in JVM

Our JVMs are consuming more memory than expected. We did some profiling and found that there is no leak. Used heap memory goes till 2.9 GB max but it comes down to 800 MB during idle time. But committed heap increased till 3.5 GB (sometimes 4 GB) and never comes down. Also after the idle time, when used heap increases from 800 MB, then committed heap memory gets increased from 3.5 GB. So our server reaches max memory size soon and we have to restart them every other day.

My questions are

  1. My understanding is that committed heap memory is currently allocated memory. When used heap memory reduces why is the committed memory not getting reduced as well?
  2. When used heap memory increases from its level (800 MB) committed heap memory also get increased from its level (from 3.5GB)

We have the below memory settings in our servers:

-Xmx4096M -Xms1536M -XX:PermSize=128M -XX:MaxPermSize=512M

You can try to tune -XX:MaxHeapFreeRatio which is "maximum percentage of heap free after GC to avoid shrinking". Default value = 70

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM