【发布时间】:2019-09-30 18:06:46
【问题描述】:
我得到了OutOfMemoryException,而堆似乎还有足够的空间。
我自己的日志报告 - VM Memory used 22.28G out of 48G
来自-XX:+PrintGCDetails -XX:+PrintAdaptiveSizePolicy -XX:+UnlockDiagnosticVMOptions -XX:+G1PrintHeapRegions 的日志似乎同意只使用 25G 出 48G
[Eden: 0.0B(2448.0M)->0.0B(2448.0M) Survivors: 0.0B->0.0B Heap: 24.9G(48.0G)->24.9G(48.0G)]
159.360: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: allocation request failed, allocation request: 48 bytes]
159.360: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion amount: 16777216 bytes, attempted expansion amount: 16777216 bytes]
159.360: [G1Ergonomics (Heap Sizing) did not expand the heap, reason: heap already fully expanded]
这个问题似乎是 G1 特有的。在 Java 8 上使用默认的 gc 算法时,内存利用率在抛出OutOfMemoryException 之前会更接近-mx48G 阈值。
我正在使用以下参数
-XX:+UseG1GC -mx48G
【问题讨论】:
标签: java memory garbage-collection