Jakub is a Java EE developer since 2005 and occasionally a project manager, working currently with Iterate AS. He's highly interested in developer productivity (and tools like Maven and AOP/AspectJ), web frameworks, Java portals, testing and performance and works a lot with IBM technologies. A native to Czech Republic, he lives now in Oslo, Norway. Jakub is a DZone MVB and is not an employee of DZone and has posted 155 posts at DZone. You can read more from them at their website. View Full User Profile

How to Set JVM Memory for Clojure REPL in Emacs

07.06.2012
| 3411 views |
  • submit to reddit

How to increase heap size for Clojure REPL started from Emacs, either standalone or as a part of a project.

1. Clojure REPL Started for a Lein Project

If you have a Leiningen 2.0 project and start Clojure REPL for it in Emacs via M-x clojure-jack-in then you can set JVM arguments such as heap size in the project.clj:

(defproject cascalog-comoyo "0.1.0-SNAPSHOT"
; ...
:jvm-opts ["-Xmx768M"])

2. Clojure REPL Started Outside of Lein

If you use Jake McCrary’s clojure-swank operation to start Clojure REPL in Emacs without having a Leiningen project then you can set JVM options by adding them to the shell-command call in clojure-swank’s definition:

...
(shell-command "JAVA_OPTS='-Xmx768M' ~/.lein/bin/swank-clojure &" buffer))
...

 

 

Published at DZone with permission of Jakub Holý, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)