Project Zomboid Server Memory: How Much RAM Does Your PZ Server Need?
Running a stable Project Zomboid dedicated server comes down to one thing more than any other: giving the Java Virtual Machine enough heap memory. Too little RAM and players see "Connection lost," chunk-load stalls, item duplication, and eventually OutOfMemoryError crashes. This guide gives you the real-world numbers we see across hundreds of hosted PZ servers, the exact -Xmx flag to set, and how to diagnose RAM-related crashes.
Quick rule of thumb: Vanilla PZ multiplayer needs 3 GB base + 0.5 GB per player. Modded servers need 6 GB base + 1 GB per player. Build 42 servers need at least 50% more than equivalent Build 41 setups.
RAM Allocation Table (Real-World Numbers)
| Setup | Players | Build 41 RAM | Build 42 RAM |
|---|---|---|---|
| Vanilla, small group | 2-4 | 4 GB | 6 GB |
| Vanilla, medium | 4-8 | 6 GB | 8 GB |
| Vanilla, large | 8-16 | 8 GB | 12 GB |
| Light mods (5-15 mods, no map packs) | 4-8 | 8 GB | 10 GB |
| Medium mods (Brita's, ORGM, simple QoL stack) | 8-16 | 10-12 GB | 14-16 GB |
| Heavy mods (Eerie Country, Brita's, Vehicle Mods, MapPacks) | 16-32 | 14-16 GB | 20-24 GB |
| Mega-modded RP server | 32+ | 20-24 GB | 28-32 GB |
These are JVM heap (the -Xmx value), not total system RAM. Your host needs at least 1-2 GB beyond the heap for OS overhead and Steam updates.
Where to Set the Memory Flag
Self-Hosted (Linux Dedicated Server)
The PZ dedicated server reads memory flags from start-server.sh in your install directory. Edit the -Xmx value:
Set -Xms (initial) equal to or about half of -Xmx (max). Don't set -Xmx higher than 75% of total system RAM — leave headroom for the OS.
Self-Hosted (Windows Dedicated Server)
Windows uses StartServer64.bat (in the install root). Open it in Notepad++ and find:
Steam Workshop "Host Server" (in-game)
The Host Server menu in PZ has a RAM slider. Max is whatever your client RAM supports. Don't use Host Server for serious multiplayer — it shares memory with the client, and 32 GB clients still struggle past 6-8 modded players.
Managed Hosting
If you're on a managed host (us included), RAM is set by your plan tier and you don't edit -Xmx directly. Supercraft Project Zomboid plans start at $5.99/mo with Plan S (8 GB), Plan M (16 GB), Plan L (32 GB). Modded servers should pick Plan M or higher.
OOM Symptoms — Recognize the Pattern
"Connection lost" for everyone simultaneously
The JVM ran out of heap. All clients drop at once. Logs show java.lang.OutOfMemoryError: Java heap space. Fix: bump -Xmx by 50%, restart.
Server lags worse over hours, recovers after restart
Memory leak from a mod or accumulated garbage collection pressure. Fix: schedule a daily restart; check mod compatibility list; consider -XX:+UseG1GC if not already set.
Items duplicating, vehicles vanishing
Often a side-effect of forced GC pauses when the heap is near full. The server stalls, packets re-fire, state desyncs. Fix: more RAM solves it.
Player can't load — stuck on "Initializing"
Sometimes RAM-related when chunk-load times out. See our PZ Server Stuck on Initializing guide for the full diagnostic flow.
Server starts then dies in 30 seconds
-Xmx set higher than the system has free. Java fails to allocate the heap and aborts. Check free -h on Linux or Task Manager on Windows.
"Server terminated" message in PZ logs
OOM, JVM crash, or system OOM-killer. See our PZ Server Terminated diagnostic.
Build 41 vs Build 42 Memory Behavior
Build 42 is a different story for memory. The new chunk format, animal AI, basement system, and crafting overhaul all push Java heap usage well above Build 41 baselines. Specific patterns we see:
- Animal spawning is the biggest single driver. A Build 42 server with the default animal density uses about 35% more RAM than vanilla Build 41 same-player-count.
- Basements load on demand, but every loaded basement chunk holds in memory until the player leaves an exterior cell.
- The new crafting tree retains a per-player cache that doesn't release between sessions.
- Mod ecosystem isn't fully Build 42 compatible yet. Many mods leak heap on Build 42 because they hold references the new architecture changed. Wait 2-4 weeks after a major Build 42 patch before adding a mod to a serious server.
Garbage Collection Tuning (Advanced)
For servers with 12+ GB heap, the JVM's default GC choices stop being optimal. Add these flags to start-server.sh:
G1GC keeps pause times predictable, which matters more than raw throughput for game servers. MaxGCPauseMillis=200 tells the GC to chunk its work to keep pauses under 200ms — players experience these as imperceptible micro-stutters rather than 1-2 second freezes.
Diagnosing a Memory Issue Before It Crashes
- Tail server logs and grep for
OutOfMemory:tail -f Zomboid/server-console.txt | grep -i memory - Watch JVM heap:
jcmd $(pgrep java) GC.heap_info - Watch system RAM:
watch -n 5 free -h - If heap usage stays >85% during peak hours, you need more RAM. Period.
Common Mistakes
- Setting
-Xmxequal to total system RAM. Java can't actually allocate that much (OS overhead, kernel reservations). Use 75-80% of total at most. - Running the dedicated server alongside a graphical desktop. X11 / GNOME chews 1-2 GB you could give to PZ.
- Ignoring swap. A small swap (4-8 GB) saves you from hard crashes when allocation spikes briefly.
- Not restarting after mod updates. Mods that change tile data or items often leak old references on hot-reload. Restart cleanly.
Related Project Zomboid Guides
- Allocate RAM (Client / Single-Player)
- Project Zomboid Dedicated Server Setup Guide (2026)
- Build 42 Dedicated Server Setup
- Build 42 Infinite Server Uptime
- PZ Server Performance Tuning
- Build 42 Multiplayer Lag Optimization
- Server Sleeping (Reduce Idle Load)
Skip the RAM math? Rent a managed PZ server starting at $5.99/mo — Plan S includes 8 GB, Plan M 16 GB, Plan L 32 GB. Tuned start-server.sh with G1GC, automatic backups, mod-version pinning, 5 datacenter regions, and 2-day refund.