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

KVHashtable doesn't deallocate entries

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 17
    • 18
    • hotspot
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: