KVHashtable doesn't deallocate entries

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 18
    • Affects Version/s: 17
    • Component/s: hotspot
    • b02

      The destructor for KVHashtable should deallocate entries but it doesn't, so if you don't write the deallocation code yourself, entries will leak.
      There are two KVHashtables in the code for CDS Dumping, which make it hard to notice the leak.

      Something like:

        ~KVHashtable() {
          KVHashtableEntry* probe = NULL;
          for (int index = 0; index < table_size(); index++) {
            for (KVHashtableEntry** p = bucket_addr(index); *p != NULL; ) {
              probe = *p;
              *p = probe->next();
              free_entry(probe);
            }
          }
          assert(BasicHashtable<F>::number_of_entries() == 0, "should have removed all entries");
        }

            Assignee:
            Coleen Phillimore
            Reporter:
            Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: