JDK-8048192 : (bf) Out of direct buffer memory message should include the limits
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2010-09-21
  • Updated: 2019-02-28
  • Resolved: 2019-02-22
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 13
13 b10Fixed
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
In the java.nio.Bits class the line:

throw new OutOfMemoryError("Direct buffer memory");

is not very useful for debugging problems. It would be significantly more useful if the message included the values of the reservedMemory, size, and maxMemory fields.

JUSTIFICATION :
The current message makes it very difficult to debug direct memory problems, and a tiny change would make it significantly more useful.

Comments
Labelled "noreg-other" as the exception is exercised by java/nio/Buffer/LimitDirectMemory.java.
22-02-2019

It does appear to be a useful request. synchronized (Bits.class) { if (totalCapacity + cap > maxMemory) throw new OutOfMemoryError("Direct buffer memory"); reservedMemory += size; totalCapacity += cap; count++; } BufferPoolMXBean is not much help post Error.
26-06-2014

BufferPoolMXBean can be used to monitor direct buffer usage.
23-06-2014