I know I can use

ulimit -v ###KiloBytes###

to limit the virtual memory of a shell and all subprocesses started by it, but it's annoying to have to open emacs from a shell everytime just for such a limit.

I want my REPL's and shell-mode buffers to crash earlier if I run some infinite loop that tries to use up too much memory.

Is there a way to set a virtual memory limit from my .emacs file?


I'm not aware that Emacs exposes system calls to change resource limits. Generally Emacs' exposure of specific OS calls is very limited beyond the basic UNIX interface and even there it's lacking.

I'm afraid that you cannot change these limits from within Emacs.

You'll have to look at cgroups or whatever your OS provides to configure resource usage of processes externally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.