Publish peak post GC heap size in BEP whenever we recorded it.
Previously, it would only be published when `--bep_publish_used_heap_size_post_build` is passed which also triggers an extra GC after the build.
@@ -98,12 +98,11 @@ class MetricsCollector {
System.gc();
MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
memoryMetrics.setUsedHeapSizePostBuild(memBean.getHeapMemoryUsage().getUsed());
- Optional<Long> peakPostGcHeapSize =
- PostGCMemoryUseRecorder.get().getPeakPostGCHeapMemoryUsed();
+ }
+ Optional<Long> peakPostGcHeapSize = PostGCMemoryUseRecorder.get().getPeakPostGCHeapMemoryUsed();
if (peakPostGcHeapSize.isPresent()) {
memoryMetrics.setPeakPostGcHeapSize(peakPostGcHeapSize.get());
}
- }
return memoryMetrics.build();
}
