Thrum

Why is a java process using so much memory or CPU on my Mac?

Last reviewed: 19 November 2026. The /usr/bin/java launcher and java_home checked on macOS 26.3.1.

A java process is a Java virtual machine running some program, often a build daemon such as Gradle, a language server, a local server, Minecraft Java Edition or a desktop tool. Java reserves a large heap up front and keeps memory until it exits, so high memory is common, and CPU comes from the program's work and garbage collection. The JDK's jcmd command lists Java processes with the main class or JAR they run.

java at a glance

java
Made byThe Java runtime (OpenJDK builds from Oracle and others)
TypeJava virtual machine process
Location/Library/Java/JavaVirtualMachines/[jdk]/Contents/Home/bin/java
Runs asyour user
Can you quit it?Yes, but the program it runs stops. Identify it first; build daemons can be stopped with their own command.

What is java?

macOS does not include Java. /usr/bin/java is a launcher for a JDK installed in /Library/Java/JavaVirtualMachines; with none installed, /usr/libexec/java_home reports that it is unable to locate a Java Runtime. /usr/libexec/java_home -V lists the JDKs it can find.

Many apps bundle their own Java runtime, so a java process may run from inside an app's bundle or from a tool's cache folder. Apps such as IDEs that ship their own runtime often appear under the app's name instead of java.

Is java safe?

The Java runtime is safe; check what it is running. A java process you cannot link to a tool, project, game or app you use deserves a look at its command line.

Why does java use so much memory and CPU?

How much memory is normal for java?

Hundreds of megabytes to several gigabytes of memory is typical for a JVM, depending on the program and its heap settings. Memory that stays flat after the program warms up is normal.

CPU should fall to near 0% when the program is idle, as a build daemon between builds is.

How do you find out what a java process is running?

  1. List Java processes. Run jcmd (or jcmd -l) in Terminal. The JDK documentation says it lists the JVM process IDs with the main class and command-line arguments used to start each one.
  2. Read its command line and parent. Run ps -o pid,ppid,args -p <PID>. Look for -jar, a main class such as GradleDaemon, and heap options like -Xmx.
  3. Stop Gradle daemons. Run gradle --status to list daemons, and gradle --stop (or ./gradlew --stop in a project) to stop them.
  4. Look inside a busy JVM. jcmd <PID> Thread.print prints every thread's stack and jcmd <PID> GC.heap_info shows the heap, which tells you whether the CPU is the program or the garbage collector.

When should you worry about java?

A java process that starts at login, which you cannot link to any tool or app, should be traced through its command line and any job in ~/Library/LaunchAgents that starts it.

Memory that grows steadily over hours until the program slows down is a sign of a memory leak in that program.

How do you check java in Activity Monitor and Terminal?

Open Activity Monitor (Applications > Utilities), and type java in the search field. The Memory tab shows its Memory. The CPU tab shows its % CPU. Double-click the row for its parent process, memory details and open files.

In Terminal, the first command lists every java process with its PID, user, CPU and memory (RSS is resident memory in kilobytes).

ps -axo pid,user,%cpu,%mem,rss,command | grep -F 'java' | grep -v grep

How can Thrum help with java?

Thrum's Memory tab shows memory pressure, swap, and the eight processes using the most memory, so you can see how much java holds and whether the Mac is short of memory. An optional alert tells you when memory pressure turns critical. Click java in the list for its PID, threads and memory, and Quit or Force Quit it after a confirmation.

Thrum is $4.99 once with a 14-day free trial and no account. It requires macOS 26 Tahoe on Apple silicon or Intel.

Questions about java

Why does java use so much memory even when idle?

The JVM sizes its heap for the program and does not return all of it to macOS right away, so an idle JVM can still show a large footprint.

Does my Mac need Java?

macOS does not need it. You only need a JDK for the apps or tools that run on Java.

Sources