I notice a strange phenomenon in my application. I store objects in the Hashmap after sending them to the server and delete them when the answer comes.
I recently noticed a very slow performance after launch. After checking, I found that the memory usage is 4 GB and then drops to less than 1 GB. I suspect it cleans up a lot of objects, so performance is so poor.
So the question is, why does it take Java to collect garbage so late? That is, why wait until the heap is full, and then do the garbage collection? Do not collect garbage at regular intervals.
Objects that are stored in the HashMap are created right at this very time, that is, they are not durable.
This is on Linux (RHEL), Oracle JVM HotSpot 7. 64-bit. 4 cores. Here's how the application starts:
java -jar -Xmx4g prog.jar
Note: I saw this: Configuring garbage collectors for low latency But for now I want to understand why the GC has been taking so long?
user2374107
source share