Skip to content
Tickwise
CriticalMemorySIG-MEM-004

Direct memory exhausted (OutOfMemoryError: direct buffer memory)

Platforms
Paper · Purpur · single server
Verified
Verified
Confidence
Confidence 80%

What it looks like in the log

Any one of these lines is enough. The agent matches them locally, on your server.

logs/latest.log
  • [WARN] java.lang.OutOfMemoryError:
  • [WARN] OutOfDirectMemoryError: failed to allocate

Symptoms

  • Players get kicked, connections drop, networking plugins/voice chat/maps stop working
  • In the log: “Cannot reserve N bytes of direct buffer memory” or Netty “OutOfDirectMemoryError”

Cause

Off-heap (direct) memory used by Netty and by plugins with native buffers (voice chat, web maps, compression) has run out. The default limit equals -Xmx, unless -XX:MaxDirectMemorySize is set.

Possible causes

  • A direct buffer leak in a plugin (voice chat, web map, packet plugins)
  • -XX:MaxDirectMemorySize or -Dio.netty.maxDirectMemory is set too low
  • A spike in network load (many players, an attack, large packets/resource pack)

How to fixMedium risk

  1. Restart the server if connections do not recover.
  2. Check the evidence for which plugin/thread was allocating memory (trace frames) and update that plugin.
  3. Check the JVM flags: if -XX:MaxDirectMemorySize or -Dio.netty.maxDirectMemory is set, increase the value with the container limit in mind (heap + direct + ~1 GB must not exceed the limit).
  4. If OOM recurs, compare the error times with peaks in player count/traffic and with when networking plugins were installed.

Translated from the Russian original; log lines are quoted verbatim.

Sources