words on sand

from shri at drone-ah.com

26 Jul 2024

Limit Java Memory Globally

Java can be greedy with RAM. By default, it grabs up to half your system memory, which is fine for servers—but annoying on a dev machine.

You can tame this by setting:

1
export JAVA_TOOL_OPTIONS="-Xmx1G"

I dropped this into my .bashrc, and it instantly reduced background memory pressure. One gig is plenty for most compile-and-run tasks during development.