I have a java application that sometimes needs a lot of memory. Regularely it consumes 100-200 MB, but sometimes, for 1-2 minutes it consumes ~2 GB.
Because I have to support this scenario, I set the xmX to 2048.
The problem is that the GC will not release this memory unless the application needs more memory. The server becomes slow and heavy, and I have no way to make this application to free the memory.
I tried to call System.gc() after that part without success.
Are there more VM parameters that can help here? Is there any way to force the GC to run?
Thanks!