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

KVHashtable doesn't deallocate entries

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 17
    • 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");
        }

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

              Created:
              Updated:
              Resolved: