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

BasicHashtable entry management needs to be cleaned up

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 12
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      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

              • Assignee:
                Unassigned
                Reporter:
                iklam Ioi Lam
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: