It’s generally best to not allow more than the maximal necessary (with a little reserve).
Java works with a garbage collection algorithm, so it doesn’t clean up memory until triggered. Under certain algorithms, like the default CMS (Concurrent Mark Sweep), the easy objects will be cleaned up regularly, but some objects are hard to clean up (objects that existed a long time before being dropped, objects with circular references to each other but no active references from the main thread anymore, etc). These objects that are hard to clean up won’t be cleaned up by the CMS until necessary.
But then, when the CMS starts to clean up those objects, it has to stop the world (put all threads in “pause” mode), until the data is cleaned again. When there are a huge amount of objects to clean up, and certainly when some of these objects have been written to the pagefile by Windows, this stop the world can make it look like Ignition crashed.
Depending on the available memory, and the speed at which the memory builds up, it can take days or weeks before a complete clean needs to happen. And when this happens if nobody is watching, it won’t be very noticeable. So it can take months to notice.
There are better garbage collection algorithms, like G1GC, this does the cleanup in smaller batches. This means you have more, but shorter pauses on your threads. And it avoids Windows writing a big amount of memory to the pagefile.
But all in all, it’s still advisable to give the JVM a reasonable amount of memory. Not too much, and not too little. If you only ever use 1 GB of memory, there’s no point in giving 16 GB to the JVM.
Since version 7.9, Ignition also has a memory profiler on the gateway page, that’s a great tool to keep track of the memory usage of the gateway and adjust the memory as needed.