GNU emacs on OSX 10.9: fix for runaway CPU

There's a fairly well documented, and rather annoying, bug in Emacs 24.3 on OSX 10.9. Under some circumstances it either consumes a lot of memory and CPU and starts to run very slowly, or it causes distnoted to do likewise. It happens particularly after sleep and wake-up, and if distnoted is the victim it's usually enough to get the fans to come on and stay on. It happens to me roughly once a week. The bug is present in the binaries available from http://emacsformacosx.com.

There is a patch:

It's apparently incorporated in the 24.4 pre-tests and nightlies, if you like to live dangerously.

I've applied the patch to a set of clean 24.3 sources and compiled it on 10.9.4 with the latest version of XCode, to get the fix without any other changes.

If anyone needs the binaries:

http://www.batten.eu.org/~igb/emacs-24.3-leakpatch-mavericks.tar.xz

SHA256 hash [1] is f94c2f9dbf40ff42dd8ee41ce7fab4e1f5208c2178aa99ab8a8344560e49d41c

Just untar it and move the resulting Emacs.app directory to /Applications or wherever you keep such things. The OSX tar command now automagically handles .xz.

Aficionados of the ludicrous bloat of modern software will have their prejudices confirmed upon learning that using a good compression algorithm, the installation kit (ie a tar of /Applications/Emacs.app) is 100MB.

ian

[1] openssl dgst -sha256 -hex < emacs-24.3-leakpatch-mavericks.tar.xz