8268952: Automatically update heap sizes in G1MonitoringScope

Reviewed-by: kbarrett, iwalulya
This commit is contained in:
Thomas Schatzl 2021-06-21 11:11:14 +00:00
parent cbec37d45d
commit a58c477c49
4 changed files with 7 additions and 11 deletions

View File

@ -3067,12 +3067,6 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
print_heap_regions();
trace_heap_after_gc(_gc_tracer_stw);
// We must call G1MonitoringSupport::update_sizes() in the same scoping level
// as an active TraceMemoryManagerStats object (i.e. before the destructor for the
// TraceMemoryManagerStats is called) so that the G1 memory pools are updated
// before any GC notifications are raised.
g1mm()->update_sizes();
gc_tracer_report_gc_end(concurrent_operation_is_full_mark, evacuation_info);
}
// It should now be safe to tell the concurrent mark thread to start

View File

@ -51,11 +51,6 @@ G1FullGCScope::G1FullGCScope(G1MonitoringSupport* monitoring_support,
}
G1FullGCScope::~G1FullGCScope() {
// We must call G1MonitoringSupport::update_sizes() in the same scoping level
// as an active TraceMemoryManagerStats object (i.e. before the destructor for the
// TraceMemoryManagerStats is called) so that the G1 memory pools are updated
// before any GC notifications are raised.
_g1h->g1mm()->update_sizes();
_g1h->trace_heap_after_gc(&_tracer);
_g1h->post_full_gc_dump(&_timer);
_timer.register_gc_end();

View File

@ -343,7 +343,12 @@ MemoryUsage G1MonitoringSupport::old_gen_memory_usage(size_t initial_size, size_
}
G1MonitoringScope::G1MonitoringScope(G1MonitoringSupport* g1mm, bool full_gc, bool all_memory_pools_affected) :
_g1mm(g1mm),
_tcs(full_gc ? g1mm->_full_collection_counters : g1mm->_incremental_collection_counters),
_tms(full_gc ? &g1mm->_full_gc_memory_manager : &g1mm->_incremental_memory_manager,
G1CollectedHeap::heap()->gc_cause(), all_memory_pools_affected) {
}
G1MonitoringScope::~G1MonitoringScope() {
_g1mm->update_sizes();
}

View File

@ -238,10 +238,12 @@ public:
// Scope object for java.lang.management support.
class G1MonitoringScope : public StackObj {
G1MonitoringSupport* _g1mm;
TraceCollectorStats _tcs;
TraceMemoryManagerStats _tms;
public:
G1MonitoringScope(G1MonitoringSupport* g1mm, bool full_gc, bool all_memory_pools_affected);
~G1MonitoringScope();
};
#endif // SHARE_GC_G1_G1MONITORINGSUPPORT_HPP