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

Epsilon: 'EpsilonHeap::allocate_work' misuses the parameter 'size' as size in bytes

    XMLWordPrintable

Details

    • gc
    • b15

    Backports

      Description

        The following code in `EpsilonHeap::allocate_work` misuses the parameter `size` as size in bytes. Actually, the parameter `size` is a size in words. The comment `// <---- here` indicates the concrete misused code location.

        ```
              size_t space_left = max_capacity() - capacity();
              size_t want_space = MAX2(size, EpsilonMinHeapExpand); // <---- here

              if (want_space < space_left) {
                // Enough space to expand in bulk:
                bool expand = _virtual_space.expand_by(want_space);
                assert(expand, "Should be able to expand");
              } else if (size < space_left) { // <---- here
                // No space to expand in bulk, and this allocation is still possible,
                // take all the remaining space:
                bool expand = _virtual_space.expand_by(space_left);
                assert(expand, "Should be able to expand");
              }
        ```

        Attachments

          Issue Links

            Activity

              People

                gli Guoxiong Li
                gli Guoxiong Li
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: