Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8255131

G1CollectedHeap::is_in() returns wrong result

    XMLWordPrintable

Details

    • gc
    • b22

    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.

      Attachments

        Issue Links

          Activity

            People

              tschatzl Thomas Schatzl
              tschatzl Thomas Schatzl
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: