# Ignition java process not releasing unused memory

**URL:** <https://forum.inductiveautomation.com/t/ignition-java-process-not-releasing-unused-memory/28614>\
**Category:** Ignition\
**Created:** [September 27, 2019, 10:28am UTC](https://forum.inductiveautomation.com/t/ignition-java-process-not-releasing-unused-memory/28614 "2019-09-27T10:28:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [September 27, 2019, 10:28am UTC](https://forum.inductiveautomation.com/t/ignition-java-process-not-releasing-unused-memory/28614/1 "2019-09-27T10:28:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [September 27, 2019, 10:44am UTC](https://forum.inductiveautomation.com/t/ignition-java-process-not-releasing-unused-memory/28614/2 "2019-09-27T10:44:53Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 27, 2019, 12:06pm UTC](https://forum.inductiveautomation.com/t/ignition-java-process-not-releasing-unused-memory/28614/3 "2019-09-27T12:06:15Z")

</div>

> [@Sanderd17](#):
>
> So by default, Java doesn’t like to give memory back to the OS.

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.
