12

How can I configure SBCL so that it uses more memory than the default when I start it by using "M-x slime" in Emacs?

From what I've seen online, the answer appears to be to call SBCL, passing the argument "--dynamic-space-size <size in MB>". Since I do not call SBCL directly, I do not know how to pass it arguments.

I am using GNU Emacs 22.3.1 and SBCL 1.0.48 on Windows 7. I have no experience configuring either, so a novice's introduction would be appreciated.

sadakatsu
  • 1,255
  • 18
  • 36

2 Answers2

14

I'm using SLIME 1:20120420-2 on Debian squeeze. The answer by Kilian Foth does not work as of this version. I wrote to slime-devel and was told

As long as you're not using slime-lisp-implementations in your
~/.emacs, setting inferior-lisp-program should work.
If you're using slime-lisp-implementations, you have to modify
this variable because slime ignores inferior-lisp-program if
slime-lisp-implementations is not nil:

(setq slime-lisp-implementations                                                                                                                                                   
      '((sbcl ("sbcl" "--dynamic-space-size" "1024"))))

So, if one wants to check what the value of slime-lisp-implementations is

Just evaluate the variable slime-lisp-implementations, e.g. with M-x
eval-expression. If it's nil or not bound then it will not be used.

As it turns out, the value of slime-lisp-implementations for me was

(("sbcl" ("sbcl")) ("clisp" ("clisp")) ("ecl" ("ecl")) ("cmucl" ("cmucl")))   

So, I put the following in my ~/.emacs

(setq slime-lisp-implementations '(("sbcl" ("sbcl" "--dynamic-space-size" "1024")) ("clisp" ("clisp")) ("ecl" ("ecl")) ("cmucl" ("cmucl"))))

With regards to where this was set

If you want to figure out who or what sets it's to the value it
has, also check /etc/emacs/site-lisp/ or /usr/share/emacs/site-lisp/

In this version of SLIME, slime-lisp-implementations is set in /usr/share/emacs/site-lisp/slime/slime.el.

For documentation of slime-lisp-implementations, see the Slime Manual: 2.5.2 Multiple Lisps
or use M-x describe-variable.

All quotes above are from the thread setting heap size for SBCL for use with SLIME on slime-devel.

Kilian Foth
  • 13,904
  • 5
  • 39
  • 57
Faheem Mitha
  • 6,096
  • 7
  • 48
  • 83
  • 1
    Although its old, just wanted to say that this is the method I needed to use today. The first method didn't work for me. Thanks for posting it. – DJM Oct 30 '13 at 21:29
13

The usual way is to set the value of the variable inferior-lisp-program to the command you want executed, including any options you want to give. Don't have an emacs on me right now, but this might be enough:

(setq inferior-lisp-program "sbcl --dynamic-space-size 1024")
Kilian Foth
  • 13,904
  • 5
  • 39
  • 57
  • I replaced my previous (setq inferior-lisp-program ...) above from my .emacs file with your form above, and it worked. When I set I changed the "1024" to "2048", though, SBCL crashed, saying the value was invalid. Do you happen to know the range for this value? And why can't I allocate 2 gigs if I want to? >_> – sadakatsu Aug 24 '11 at 20:56
  • It looks like the user mode memory limit for a 32-bit process in Windows 7 is 2GB http://msdn.microsoft.com/en-us/library/aa366778%28VS.85%29.aspx . Dynamic-space-size is only part of the memory sbcl uses (though probably the largest), so 2GB of dynamic space size would put it over the 2GB limit. Or maybe there's another reason. – Samuel Edwin Ward Feb 05 '12 at 17:43