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

BasicHashtable entry management needs to be cleaned up

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • tbd
    • 12
    • hotspot
    • None

    Description

      BasicHashtable (and subclasses thereof) can allocate and free their entries in a variety of (haphazard) ways

      - entries can be block allocated or individually malloc'ed
      - entries can be freed immediately, or saved in a free list

      It's not clear what policy is used by a particular hashtable. For example, this code:

      G1CodeRootSetTable::~G1CodeRootSetTable() {
        ...
        for (BasicHashtableEntry<mtGC>* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) {
          FREE_C_HEAP_ARRAY(char, e);
        }

      it's unclear why this is safe, unless you look at the implementation of G1CodeRootSetTable::new_entry() and note that it never upcalls to BasicHashtable::new_entry() to do the block allocation.

      --------------------
      BasicHashtable should be refactored, so that it's clear what allocation/free policy is used, and to avoid mistakes such as calling free() on entries allocated by the block allocator.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: