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.
- 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
- relates to
-
JDK-8213587 Speed up CDS dump time by using resizable hashtables
- Closed