How to fix "Could not reserve enough space for object heap"

Java never started. It was asked for more memory than it could set aside, so it quit before Minecraft loaded.

Updated 2026-10-11

What the error looks like

Error occurred during initialization of VM
Could not reserve enough space for 4194304KB object heap

The number is the memory Java was asked for, and 4194304 KB is 4 GB. This is not OutOfMemoryError, which hits after the game is already running. Here nothing ran at all. You may also see Invalid maximum heap size: -Xmx..., Invalid initial heap size or Initial heap size set to a larger value than the maximum heap size. Same family.

Fix 1: ask for less

The computer didn't have that much free. Lower the number: in a launcher it's the memory slider or -Xmx in the JVM arguments, and in a start command you change -Xmx8G to -Xmx4G. On Linux, don't judge by the free column of free -h, because the system keeps spare RAM as file cache. Read the available column instead.

Fix 2: use a 64-bit Java

A 32-bit Java can't hold more than about 1.5 GB, so a larger -Xmx fails even on a machine with plenty of RAM. Run java -version. A 64-bit build prints 64-Bit Server VM on the last line. If yours doesn't, install a 64-bit Java and pick it in your launcher. The Java version guide covers which one to get.

Fix 3: check -Xms

-Xms is the starting size and it can't be bigger than -Xmx, the maximum. -Xms8G -Xmx4G fails with Initial heap size set to a larger value than the maximum heap size. The usual setup keeps them equal:

java -Xms4G -Xmx4G -jar server.jar nogui

On a hosting panel the RAM setting is capped by your plan, and setting it above what the plan includes can trigger this error. Lower it, or ask support.

Send the log

Still stuck? Send the start command and the first lines of the console or latest.log. Put them on minelog for a link.

Questions

What's the difference from OutOfMemoryError?

This error stops Java before the game starts, because the memory can't be set aside. OutOfMemoryError happens after it started, when the game used up what it was given.

Why does -Xmx2G work but -Xmx8G doesn't?

Because 8 GB isn't free on that machine, or the Java is 32-bit. Raise the number step by step until it stops starting, or close other programs first.

How much memory should I give it?

Vanilla is fine on a few gigabytes. Modpacks and busy servers often want 4 to 8 GB. Never ask for more than the computer can spare.

Keep reading

Share a log