Out of memory

OutOfMemoryError: Cannot Reserve Bytes of Direct Buffer Memory

What it looks like in the log

java.lang.OutOfMemoryError: Cannot reserve <so> bytes of direct buffer memory (allocated: <so>, limit: <so>)

How to fix it

  1. Inspect your launcher's JVM arguments and delete any -XX:MaxDirectMemorySize=... parameter if one was added by a custom optimization argument list.
  2. Increase your allocated RAM (-Xmx) in your launcher profile from 2G to 4G or 6G (leaving at least 4 GB of physical system RAM free for Windows and off-heap buffers), since Java raises the default direct buffer limit alongside -Xmx.
  3. Update rendering and shader mods such as Sodium, Iris, Embeddium, or Oculus to their latest official releases, and replace old bundled forks (like legacy custom Sodium+Iris builds) that suffer from vertex buffer leaks.
  4. Lower Render Distance, turn off shaders temporarily, or disable high-resolution (128x and above) resource packs to reduce off-heap geometry and texture buffer allocations.
LoadersVanilla, Fabric, Quilt, Forge, Neoforge
SeverityStops the game
CategoryOut of memory

Check your own log

Related errors