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

SymbolTableHash::Node allocations allocates twice the required memory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 21, 23
    • hotspot
    • b02

      The symbols are inline and allocated together with the ConcurrentHashTable (CHT) Nodes. The calculation used for the required size is `alloc_size = size + value.byte_size() + value.effective_length();`

      Where
        * `size == sizeof(SymbolTableHash::Node) == sizeof(void*) + sizeof(Symbol)`
        * `value.byte_size() == dynamic_sizeof(Symbol) == sizeof(Symbol) + <bytes beyond object>`
        * `value.effective_length() == dynamic_sizeof(Symbol) - sizeof(Symbol) == <bytes beyond object>`

      So `alloc_size` ends up being `sizeof(void*) /* node metadata */ + 2 * dynamic_sizeof(Symbol)`

            aboldtch Axel Boldt-Christmas
            aboldtch Axel Boldt-Christmas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: