JDK-8344997 : (bf) Temporary direct buffers should not count against the upper limit on direct buffer memory
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 24
  • Submitted: 2024-11-25
  • Updated: 2024-11-26
  • Resolved: 2024-11-26
Related Reports
CSR :  
Description
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.
Comments
Moving to Approved.
26-11-2024

I've updated the compatibility risk section to explain the implication for observability. However, in general I would think this change will be welcomed as it avoids JDK use of direct buffers from limiting application/library usage.
26-11-2024