Reputation: 1009
We know that in Java a full GC can hang the JVM, which can also be called STOP-THE-WORLD. In many applications, hanging the JVM too long will cause a lot of problems. I want to know how to reduce the time of STOP-THE-WORLD in GC? What are the potential drawbacks caused by reducing the time of STOP-THE-WORLD? (not considering the JVM without stop-the-world behavior)
Upvotes: 3
Views: 1990
Reputation: 51
If your objects live long time you can try to use DirectBuffers from New I/O package. Their creation and reclamation is more expensive than the creation and reclamation of heap-based non-direct buffers because direct buffers are managed using OS-specific native code. This added management cost makes direct buffers a poor choice for single-use or infrequently used cases.
Direct buffers are also outside the scope of Java’s garbage collector.
Upvotes: 0
Reputation: 533492
There are many approaches
I would start with the memory profiler to reduce garbage and heap usage, and tune the GC.
Upvotes: 2