提交 b1199551 编写于 作者: M mgerdin

8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor

Reviewed-by: jwilhelm, jmasa
上级 4c61047a
...@@ -117,7 +117,7 @@ void G1RootProcessor::wait_until_all_strong_classes_discovered() { ...@@ -117,7 +117,7 @@ void G1RootProcessor::wait_until_all_strong_classes_discovered() {
G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) :
_g1h(g1h), _g1h(g1h),
_process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), _process_strong_tasks(G1RP_PS_NumElements),
_srs(g1h), _srs(g1h),
_lock(Mutex::leaf, "G1 Root Scanning barrier lock", false), _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false),
_n_workers_discovered_strong_classes(0) {} _n_workers_discovered_strong_classes(0) {}
...@@ -160,7 +160,7 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, ...@@ -160,7 +160,7 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots,
{ {
// Now the CM ref_processor roots. // Now the CM ref_processor roots.
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) {
// We need to treat the discovered reference lists of the // We need to treat the discovered reference lists of the
// concurrent mark ref processor as roots and keep entries // concurrent mark ref processor as roots and keep entries
// (which are added by the marking threads) on them live // (which are added by the marking threads) on them live
...@@ -203,12 +203,12 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, ...@@ -203,12 +203,12 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots,
// as implicitly live). // as implicitly live).
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) {
JavaThread::satb_mark_queue_set().filter_thread_buffers(); JavaThread::satb_mark_queue_set().filter_thread_buffers();
} }
} }
_process_strong_tasks->all_tasks_completed(); _process_strong_tasks.all_tasks_completed();
} }
void G1RootProcessor::process_strong_roots(OopClosure* oops, void G1RootProcessor::process_strong_roots(OopClosure* oops,
...@@ -218,7 +218,7 @@ void G1RootProcessor::process_strong_roots(OopClosure* oops, ...@@ -218,7 +218,7 @@ void G1RootProcessor::process_strong_roots(OopClosure* oops,
process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0); process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0);
process_vm_roots(oops, NULL, NULL, 0); process_vm_roots(oops, NULL, NULL, 0);
_process_strong_tasks->all_tasks_completed(); _process_strong_tasks.all_tasks_completed();
} }
void G1RootProcessor::process_all_roots(OopClosure* oops, void G1RootProcessor::process_all_roots(OopClosure* oops,
...@@ -228,11 +228,11 @@ void G1RootProcessor::process_all_roots(OopClosure* oops, ...@@ -228,11 +228,11 @@ void G1RootProcessor::process_all_roots(OopClosure* oops,
process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0);
process_vm_roots(oops, oops, NULL, 0); process_vm_roots(oops, oops, NULL, 0);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) {
CodeCache::blobs_do(blobs); CodeCache::blobs_do(blobs);
} }
_process_strong_tasks->all_tasks_completed(); _process_strong_tasks.all_tasks_completed();
} }
void G1RootProcessor::process_java_roots(OopClosure* strong_roots, void G1RootProcessor::process_java_roots(OopClosure* strong_roots,
...@@ -248,7 +248,7 @@ void G1RootProcessor::process_java_roots(OopClosure* strong_roots, ...@@ -248,7 +248,7 @@ void G1RootProcessor::process_java_roots(OopClosure* strong_roots,
// let the thread process the weak CLDs and nmethods. // let the thread process the weak CLDs and nmethods.
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
} }
} }
...@@ -265,49 +265,49 @@ void G1RootProcessor::process_vm_roots(OopClosure* strong_roots, ...@@ -265,49 +265,49 @@ void G1RootProcessor::process_vm_roots(OopClosure* strong_roots,
uint worker_i) { uint worker_i) {
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Universe_oops_do)) {
Universe::oops_do(strong_roots); Universe::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_JNIHandles_oops_do)) {
JNIHandles::oops_do(strong_roots); JNIHandles::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i);
if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) {
ObjectSynchronizer::oops_do(strong_roots); ObjectSynchronizer::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) {
FlatProfiler::oops_do(strong_roots); FlatProfiler::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Management_oops_do)) {
Management::oops_do(strong_roots); Management::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_jvmti_oops_do)) {
JvmtiExport::oops_do(strong_roots); JvmtiExport::oops_do(strong_roots);
} }
} }
{ {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i); G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) {
SystemDictionary::roots_oops_do(strong_roots, weak_roots); SystemDictionary::roots_oops_do(strong_roots, weak_roots);
} }
} }
...@@ -335,5 +335,5 @@ void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, ...@@ -335,5 +335,5 @@ void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
} }
void G1RootProcessor::set_num_workers(int active_workers) { void G1RootProcessor::set_num_workers(int active_workers) {
_process_strong_tasks->set_n_threads(active_workers); _process_strong_tasks.set_n_threads(active_workers);
} }
...@@ -45,7 +45,7 @@ class SubTasksDone; ...@@ -45,7 +45,7 @@ class SubTasksDone;
// worker thread call the process_roots methods. // worker thread call the process_roots methods.
class G1RootProcessor : public StackObj { class G1RootProcessor : public StackObj {
G1CollectedHeap* _g1h; G1CollectedHeap* _g1h;
SubTasksDone* _process_strong_tasks; SubTasksDone _process_strong_tasks;
SharedHeap::StrongRootsScope _srs; SharedHeap::StrongRootsScope _srs;
// Used to implement the Thread work barrier. // Used to implement the Thread work barrier.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册