Developers can call System.gc() anywhere in their code to instruct the JVM to prioritize garbage collection. When a developer calls this method -- and there isn't an extreme load on the JVM -- a Java GC cycle will happen within seconds.
---
I've been using a variant on the example server module provided by Union that profiles memory, altered slightly to output to both log and console.
I added the hack code above to run every time the module writes current memory to the log/console.
So far so good. Memory stays normal. Seems too good to be true, but I thought I'd pass it along.
See attached zip file containing union.xml and server module directory.