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

Non-C-heap allocated ResourceHashtable keys and values must have trivial destructor

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 21
    • None
    • hotspot
    • None
    • b09

    Description

      ResourceHashtableBase deletes the ResourceHashtableNode only when the table is allocated on the C heap. For example:

      https://github.com/openjdk/jdk/blob/09bfbf80639f059563fcd4432995b8c380cea298/src/hotspot/share/utilities/resourceHash.hpp#L99-L113

      When "delete" is used, the destructors for ResourceHashtableNode::_key and ResourceHashtableNode::_value are also called. These destructors can perform clean up as necessary.

      We should add a static assert that if the ResourceHashtable is not C-Heap allocated, the key and value must be types that are trivially destructible (see https://en.cppreference.com/w/cpp/types/is_destructible). Otherwise, the clean up expected by the key and value types will never happen.

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: