1

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!

Matan
  • 680
  • 2
  • 14
  • 24

1 Answers1

1

Actually, some does give back the memory to the operating system : The SerialGC and G1GC. If you use the throughput collector or the low-pause collector, the JVM won't release any memory to the OS.

You can have more details on this article.

Hope that helps !

Pierre Laporte
  • 1,205
  • 8
  • 11