JDK-8214030 : BasicHashtable entry management needs to be cleaned up
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2018-11-19
  • Updated: 2020-02-18
  • Resolved: 2020-02-18
Related Reports
Relates :  
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.
Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
18-02-2020