Why the Default RAM Limit Causes Problems
Project Zomboid runs on the Java Virtual Machine and ships with a 2GB memory cap set via the JVM flag -Xmx2048m. For vanilla play this is usually enough, but large mod packs, custom maps, and high player count servers push the game well past 2GB of usage. When the client hits its memory ceiling, Java's garbage collector kicks in aggressively, causing visible stutters and frame drops. If it cannot recover, the game crashes with an out-of-memory error in the log.
Increasing the cap gives the JVM more headroom, which means less garbage collection pressure and smoother gameplay.
Does This Affect Other Apps or System Java
No. Project Zomboid includes its own embedded Java runtime (JRE) inside the game folder. The -Xmx flag in this file only applies to that specific PZ process. Your system Java installation and other apps are completely unaffected.
If the game still crashes after increasing RAM, the cause is likely a memory leak in a mod or an outdated mod conflicting with the current game version. More RAM gives you headroom but does not fix a leak. Check your mod list for anything that has not been updated recently.