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
- Restart the server if connections do not recover.
- Check the evidence for which plugin/thread was allocating memory (trace frames) and update that plugin.
- Check the JVM flags: if
-XX:MaxDirectMemorySizeor-Dio.netty.maxDirectMemoryis set, increase the value with the container limit in mind (heap + direct + ~1 GB must not exceed the limit). - 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.