Duration of Excessive GC Time in “java.lang.OutOfMemoryError: GC overhead limit exceeded”

前端 未结 3 1149
深忆病人
深忆病人 2021-01-02 07:27

Occasionally, somewhere between once every 2 days to once every 2 weeks, my application crashes in a seemingly random location in the code with: java.lang.OutOfMemoryE

3条回答
  •  难免孤独
    2021-01-02 08:05

    The >98% would be measured over the same period in which less than 2% of memory is recovered.

    It's quite possible that there is no fixed period for this. For instance, if the OOM check would be done after every 1,000,000 object live checks. The time that takes would be machine-dependent.

    You most likely can't "solve" your problem by adding -XX:-UseGCOverheadLimit. The most likely result is that your application will slow to a crawl, use a bit more of memory, and then hit the point where the GC simply does not recover any memory anymore. Instead, fix your memory leaks and then (if still needed) increase your heap size.

提交回复
热议问题