RFR: 8255848: -Xlog:gc+heap+exit shows "used 0K"

Albert Mingkun Yang ayang at openjdk.java.net
Wed Nov 4 13:48:59 UTC 2020


On Wed, 4 Nov 2020 11:29:06 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

> Please review this small change to improve the exit heap-log for G1.
> 
> Currently if all allocations fit into one region the exit log will faulty state that the usage is 0K:
> $ java -Xlog:gc+heap+exit -Xshare:off -Xmx16g -version
> [0.072s][info][gc,heap,exit] garbage-first heap total 1032192K, used 0K [0x00000003c0000000, 0x00000007c0000000)
> [0.072s][info][gc,heap,exit] region size 8192K, 1 young (8192K), 0 survivors (0K)
> 
> This is cause by G1 using `used_unlocked()`, which doesn't take the current allocation region(s) into account. My proposed change is to check if the `Heap_lock` is taken and if so use `used()` instead of `used_unlocked()`. For the exit logging the lock will be held, but this log is printed using `G1CollectedHeap::print_on()` and we might want to allow calling this without requiring holding the heap lock.

Marked as reviewed by ayang (Author).

-------------

PR: https://git.openjdk.java.net/jdk/pull/1051


More information about the hotspot-gc-dev mailing list