Subject: 25.2: Feature Request: auto exit upon memory exhaustion warning

From: Boruch Baum <[email-masked]>
Date: Sun, 8 Apr 2018 03:22:23 -0400

Version: emacs 25.2, debian

As emacs begins to exhaust memory, it begins to grind all system process's
performance to a halt, which is clearly undesirable. If the user notices
in time, either because the user is attentive to the mode line or the
system slow-down, then the user will have an opportunity to gracefully
exit and restart emacs, but such is not always the case, and should not
be presumed to always be the case.

I would like to suggest a optional feature to automatically save
buffers and shut down emacs / emacs-server when this condition occurs.
The user could toggle its operation by manipulating a boolean variable.

It's default condition is for the emacs developers to decide. My vote
would be for default on, in the interest of the greater good of
preserving an entire system from grinding to a halt.

I reliably encountered memory exhaustion when testing function
`apropos-value', which creates for me that condition within five
calls.

An alternate solution, external to emacs, would be to use the shell's
`ulimit' feature, but I don't know whether this is available on all
platforms (eg. Microsoft), and would require constant tinkering of the
memory threshold limit to account for any change in requirements in the
sum of all the other system processes.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0