Skip to content

Commit 397972e

Browse files
committed
8255848: -Xlog:gc+heap+exit shows "used 0K"
Reviewed-by: tschatzl, ayang
1 parent eb85b8d commit 397972e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,10 +2437,11 @@ void G1CollectedHeap::print_heap_regions() const {
24372437
}
24382438

24392439
void G1CollectedHeap::print_on(outputStream* st) const {
2440+
size_t heap_used = Heap_lock->owned_by_self() ? used() : used_unlocked();
24402441
st->print(" %-20s", "garbage-first heap");
24412442
if (_hrm != NULL) {
24422443
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2443-
capacity()/K, used_unlocked()/K);
2444+
capacity()/K, heap_used/K);
24442445
st->print(" [" PTR_FORMAT ", " PTR_FORMAT ")",
24452446
p2i(_hrm->reserved().start()),
24462447
p2i(_hrm->reserved().end()));

0 commit comments

Comments
 (0)