Java Application "java.lang.OutOfMemoryError: Direct buffer memory"

Solution Verified - Updated -

Issue

  • java.lang.OutOfMemoryError: Direct buffer memory in the JBoss server log or java.lang.OutOfMemoryError: Cannot reserve # bytes of direct buffer memory:
java.lang.OutOfMemoryError: Cannot reserve 16384 bytes of direct buffer memory (allocated: 3221211360, limit: 3221225472)
    at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
    at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:121)
    at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:332)
  • One of the slave machines gets disconnected from the Domain Controller and starts throwing this error:
[Host Controller] 16:36:41,136 ERROR [org.xnio.listener] (management I/O-2) XNIO001007: A channel event listener threw an exception: java.lang.OutOfMemoryError: Direct buffer memory

Environment

  • Java
    • OpenJDK
    • Oracle JDK

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content