< prev index next >
src/hotspot/share/memory/heapInspection.cpp
Print this page
*** 538,547 ****
--- 538,555 ----
bool should_visit(oop obj) {
return _filter == NULL || _filter->do_object_b(obj);
}
};
+ // Heap inspection for every worker.
+ // When native OOM hanppens for KlassInfoTable, set _success to false.
+ // TODO(?) it seems atomically set/get _success is unnecessary becasue it
+ // is set to true at constructor and can only be set to false here.
+ // the only risk seems a worker may continue inspect heap when another
+ // worker set _success to false, but this is OK because the current worker
+ // doesn't change _success if everything is OK for it's inpection work, and
+ // the _success will be false finally and serial heap inpection can be tried.
void ParHeapInspectTask::work(uint worker_id) {
size_t missed_count = 0;
if (!_success) {
// other worker has failed on parallel iteration.
return;
*** 575,587 ****
--- 583,598 ----
if (parallel_thread_num > 1) {
ParallelObjectIterator* poi = Universe::heap()->parallel_object_iterator(parallel_thread_num);
if (poi != NULL) {
ParHeapInspectTask task(poi, cit, filter);
Universe::heap()->run_task(&task);
+ delete poi;
+ if (task.success()) {
return task.missed_count();
}
}
+ }
// If no parallel iteration available, run serially.
RecordInstanceClosure ric(cit, filter);
Universe::heap()->object_iterate(&ric);
return ric.missed_count();
< prev index next >