# Memory usage and garbage collector

**URL:** <https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170>\
**Category:** Ignition\
**Created:** [May 29, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170 "2020-05-29T16:27:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelo.burstein](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marcelo.burstein](https://forum.inductiveautomation.com/u/marcelo.burstein)\
**Post date:** [May 29, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170/1 "2020-05-29T16:27:30Z")

</div>

Hi,

We are checking the memory usage for a few days, the memory grows up to 3.8 GB and then goes down. The maximum memory is set to 4GB.

Is the garbage collector which reduces the memory?  
Why dows the memory go down at 3.8 GB?  
Can I set the time when garbage collector works?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [May 29, 2020, 5:01pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170/2 "2020-05-29T17:01:42Z")

</div>

Yes, you probably wnat to change to G1GC. You can’t manually tell the garbage collector to work, but as far as I know G1GC is the most recommended on to change to for Ignition. Check out this post [Gateway / Java question 7.7.2](http://forum.inductiveautomation.com/t/gateway-java-question-7-7-2/10402/2)

---

<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:** [May 29, 2020, 9:06pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170/3 "2020-05-29T21:06:15Z")

</div>

G1GC is the default for new installs. Java tries to _not_ do difficult garbage collection until needed, so memory consumption approaching your limit is normal. G1GC is very good at doing “light” GC often so that big GC is rare.

Yes, you can ask the JVM to run GC early. Not recommended, and not guaranteed to actually do anything in a busy system.

---

<div class="post-metadata">

**Author:** ![GreggCavazos](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@GreggCavazos](https://forum.inductiveautomation.com/u/GreggCavazos)\
**Post date:** [May 29, 2020, 9:49pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170/4 "2020-05-29T21:49:55Z")

</div>

> Java tries to _not_ do difficult garbage collection until needed, so memory consumption approaching your limit is normal.

That being said, would this be a normal behavior using G1GC? The chart doesn't seem to reflect all the changes I see in the memory bar, it goes between ~1000 to ~3500 every 8-10 seconds, we haven't had any issues, but I am a little concerned.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/853a7aaff43c70ceda3fab1888774f3edbf91d59.png)

---

<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:** [May 29, 2020, 10:41pm UTC](https://forum.inductiveautomation.com/t/memory-usage-and-garbage-collector/35170/5 "2020-05-29T22:41:33Z")

</div>

Seems a bit more churn than a typical system, but not out of bounds for a busy one.
