PROBLEM: As the server runs idle on versions 4.0.1 and below, memory usage may slowly increase over time.
SOLUTION: Schedule a simple, one line java service:
to run every 30 minutes or so. The Java garbage collector is a low level thread so explicitly calling it won’t force the jvm to clean up right away, but it’ll be more likely to do it when it gets the chance.
Another way to monitor memory usage is to create a handler service that runs whenever a Stat Event is published. One of the variables in the Stat Event is FreeMemPer. The handler service can check this FreeMemPer and invoke the System.gc() java service whenever it falls below a given threshold.