2 ms·
Another: buy more RAM if needed, and set -Xmx###M and -Xms###M to sufficiently high numbers so that the JVM never runs out of memory and forces a collection. Yo
by Jach 13y ago
Another: buy more RAM if needed, and set -Xmx###M and -Xms###M to sufficiently high numbers so that the JVM never runs out of memory and forces a collection. You can also do System.gc() to "suggest" a collection be done soon, such as while you're busy doing something slow that's I/O bound like reading a file or getting network data. Though I wouldn't be surprised if most of the time modern JVM GCs already know when you're doing such things, making such a hint redundant.
- joshdev 13y agoBuying more RAM only gets you so far. G1 handles large heaps fairly well, but you can still run into issues with long pauses if you are not careful and those pauses increase with the size of the heap. Most real time services don't have the luxury of manually triggering GCs and must do whatever they can to limit the stress they put on the collector.