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

KVHashtable doesn't deallocate entries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 18
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b02

      Description

      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");
        }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: