JDK-8147468 : (bf) Allow users to bound the size of buffers cached in the per-thread buffer caches
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-01-15
  • Updated: 2017-05-17
  • Resolved: 2016-01-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u102Fixed 9 b104Fixed
Related Reports
CSR :  
Relates :  
Sub Tasks
JDK-8175230 :  
Description
Some NIO channel operations use temporary DirectByteBuffers which are cached in thread-local caches to avoid having to allocate / free a buffer at every operation.

Unfortunately, there is no bound imposed on the size of buffers added to the thread-local caches. So, infrequent channel operations that require a very large buffer can create a native memory leak.

We should introduce a property, jdk.nio.MaxCachedBufferSize that if set sets a limit on the size of the buffers that can be added to the thread-local caches. Operations that require a buffer that is larger than this limit will allocate then free an one-off buffer.