Ignition java process not releasing unused memory

My server has 16gb allocated memory to ignition and after some time passes the java process reached around 15gb while the gateway memory in status page says it only consumes 4gb. Below is my ignition configuration file.

Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.

wrapper.java.additional.auto_bits=TRUE

Java Additional Parameters

wrapper.java.additional.1=-XX:+UseG1GC
wrapper.java.additional.2=-XX:MaxGCPauseMillis=100
wrapper.java.additional.3=-Ddata.dir=data
wrapper.java.additional.4=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
#wrapper.java.additional.4=-Xdebug
#wrapper.java.additional.5=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Initial Java Heap Size (in MB)

wrapper.java.initmemory=2048

Maximum Java Heap Size (in MB)

wrapper.java.maxmemory=16000

I cant seem to find what is causing the problem. Hoping for any assistance on this, any help would be greatly appreciated. Thank you

This is pretty normal behaviour.

Shrinking the allocated memory is more expensive than growing it (a lot of objects that are still needed will need to be moved in order to free memory). So by default, Java doesn’t like to give memory back to the OS.

There are some options you can set to make the shrinking more agressive. See f.e. this stackoverflow post: https://stackoverflow.com/questions/30458195/does-gc-release-back-memory-to-os

However, if you notice your Ignition instance only needs 4 GB, I would set the maximum memory to 5 or 6 GB. Then you don’t need to worry about it not giving the memory back.

1 Like

Huh. Thanks for the link. I’ve never seen java give memory back to the OS, so I didn’t think it could. That said, I would recommend a much lower max memory setting–you really don’t want the OS to start swapping.