When GC logging was converted to Unified Logging a newline went missing.
- st->print_cr("{Heap before GC invocations=%u (full %u):",
- heap()->total_collections(),
- heap()->total_full_collections());
vs
+ LogHandle(gc, heap) log;
+ if (log.is_trace()) {
+ log.trace("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
This gives lines like this:
GC(29) Heap after GC invocations=30 (full 30): ZHeap used 20M, capacity 2014M, max capacity 30718M
GC(29) Metaspace used 6779K, capacity 6857K, committed 7040K, reserved 1056768K
GC(29) class space used 574K, capacity 620K, committed 640K, reserved 1048576K
Instead of:
GC(29) Heap after GC invocations=30 (full 30):
GC(29) ZHeap used 20M, capacity 2014M, max capacity 30718M
GC(29) Metaspace used 6779K, capacity 6857K, committed 7040K, reserved 1056768K
GC(29) class space used 574K, capacity 620K, committed 640K, reserved 1048576K
In our hs_err files we print this with a newline:
st.print_cr("{Heap %s GC invocations=%u (full %u):",
before ? "before" : "after",
heap->total_collections(),
heap->total_full_collections());
- st->print_cr("{Heap before GC invocations=%u (full %u):",
- heap()->total_collections(),
- heap()->total_full_collections());
vs
+ LogHandle(gc, heap) log;
+ if (log.is_trace()) {
+ log.trace("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
This gives lines like this:
GC(29) Heap after GC invocations=30 (full 30): ZHeap used 20M, capacity 2014M, max capacity 30718M
GC(29) Metaspace used 6779K, capacity 6857K, committed 7040K, reserved 1056768K
GC(29) class space used 574K, capacity 620K, committed 640K, reserved 1048576K
Instead of:
GC(29) Heap after GC invocations=30 (full 30):
GC(29) ZHeap used 20M, capacity 2014M, max capacity 30718M
GC(29) Metaspace used 6779K, capacity 6857K, committed 7040K, reserved 1056768K
GC(29) class space used 574K, capacity 620K, committed 640K, reserved 1048576K
In our hs_err files we print this with a newline:
st.print_cr("{Heap %s GC invocations=%u (full %u):",
before ? "before" : "after",
heap->total_collections(),
heap->total_full_collections());