Skip to content
David Goldfarb edited this page Aug 24, 2017 · 9 revisions

Max Memory

One way to reduce Clojure's memory usage

Keywords

JVM, Cider

tl;dr

export _JAVA_OPTIONS="-Xmx2g"

The problem

My development machine is well endowed, with a fast processor, SSD drive, and 32GB of RAM. Nonetheless, it would sometimes grind to a halt when I worked on a ClojureScript project.

The reason was (as is usually the case) disk thrashing. My memory was over-commited. But why?

My machine runs Ubuntu, and typically has running:

  • Chrome, with many open tabs.
  • A VM running Windows 10.
  • Emacs, with many source code buffers, Cider, and two REPLs (one for Clojure and one for ClojureScript.
  • A few terminal shells, sometimes running another REPL (e.g., for tests or CSS compilation).

The solution

Clojure runs in the Java Virtual Machine (JVM). In my dev setup, I always have at least two JVMs running; sometimes more.

Clone this wiki locally