Description
The code in G1CollectedHeap::is_in() does not return whether the given pointer points into the committed heap.
bool G1CollectedHeap::is_in(const void* p) const {
if (_hrm->reserved().contains(p)) {
// Given that we know that p is in the reserved space,
// heap_region_containing() should successfully
// return the containing region.
HeapRegion* hr = heap_region_containing(p);
return hr->is_in(p);
} else {
return false;
}
}
Two issues:
- heap_region_containing() returns a valid HeapRegion* for any region ever committed
- for uncommitted regions it returns NULL, i.e. crashing at the dereference
Is_in_exact() below seems to do what is expected and not slower.
There is no actual issue reported (i.e. crash) or misreporting.
bool G1CollectedHeap::is_in(const void* p) const {
if (_hrm->reserved().contains(p)) {
// Given that we know that p is in the reserved space,
// heap_region_containing() should successfully
// return the containing region.
HeapRegion* hr = heap_region_containing(p);
return hr->is_in(p);
} else {
return false;
}
}
Two issues:
- heap_region_containing() returns a valid HeapRegion* for any region ever committed
- for uncommitted regions it returns NULL, i.e. crashing at the dereference
Is_in_exact() below seems to do what is expected and not slower.
There is no actual issue reported (i.e. crash) or misreporting.