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

(bf) Temporary direct buffers should not count against the upper limit on direct buffer memory

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • None
    • behavioral
    • minimal
    • Hide
      This change would allow applications to fully utilize allocate direct buffers up to a total of MaxDirectMemorySize without allocations of (JDK internal) temporary direct buffers affecting the constraint so there appears to be little risk.

      The downside is observability as the temporary direct buffers will not contribute the count/memory returned by the BufferPoolMXBean for the "direct" pool. In the future we might add a new pool for temporary direct buffers that could be observed.

      Show
      This change would allow applications to fully utilize allocate direct buffers up to a total of MaxDirectMemorySize without allocations of (JDK internal) temporary direct buffers affecting the constraint so there appears to be little risk. The downside is observability as the temporary direct buffers will not contribute the count/memory returned by the BufferPoolMXBean for the "direct" pool. In the future we might add a new pool for temporary direct buffers that could be observed.
    • Other
    • Implementation

      Summary

      Do not include the memory used by internal temporary direct buffers in the total of allocations which is limited by the maximum direct buffer memory size setting.

      Problem

      Currently all direct buffer memory is tracked and and the total memory allocated is limited by the maximum direct buffer memory size setting. (This value is configurable by the VM option -XX:MaxDirectMemorySize=size.) Including the amount of memory used by internal temporary buffers makes it harder for applications to limit the amount of memory application code explicitly uses and problematic to test the correct functioning of the maximum direct buffer memory size constraint.

      Solution

      Do not include the memory used by internal temporary direct buffers in the amount of memory that is limited.

      Specification

      There is no specification change; this is a behavioral change only.

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: