Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Set JVM Memory for Clojure REPL in Emacs

DZone's Guide to

How to Set JVM Memory for Clojure REPL in Emacs

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

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))
...

 

 

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Published at DZone with permission of Jakub Holý, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}