reddit / emacs
Emacs taking memory upwards of 10 gb on Apple M1 macs.
sameertj · 2022-06-10 04:22
Is there an emacs build that is specific to M1 mac books? Would that be the reason for this issue?
I installed the emacs Homebrew cask.
https://preview.redd.it/239ayjrtm2591.png?width=3438&format=png&auto=webp&s=95aba68ee14900a79beec01e35966f77fcd7bd21
worthless-trash · 2022-06-10 04:28
Please provide evidence of 10GB.
Check to see if your emacs binary is actually built for aarch64/arm64 . If its built for arm you have the build.
Relative_Tap5915 · 2022-06-10 05:03
m1 user here, usually takes hundreds of mb
sameertj · 2022-06-10 05:39
I restarted it. Have to keep running it for some days before it shows that high usage. I will post it when it happens.
onetom · 2022-06-10 06:43
most likely it's related to some external packages.
it's also possible that you are spawning processes from Emacs and the memory usage of those sub-processes count towards the memory consumption of Emacs. Think of LSP for example.Tthis is just a speculation; I didn't experience it myself, but I've seen something like that in my colleagues setup.
And on IntelliJ, when I start JVM/Clojure processes, the memory usage of those definitely added to the memory consumption of IntelliJ, if I look at it via the Activity Monitor.
Ximsa4045 · 2022-06-10 07:09
Hehe
eight gigabytes and constantly swapping
atamariya · 2022-06-10 14:37
If you're using webkit xwidget, then it might be [Gigacage](https://labs.f-secure.com/archive/some-brief-notes-on-webkit-heap-hardening/) security feature.
Sudo_Brew · 2022-06-10 15:09
Are you using LSP? I've noticed that running multiple LSP servers at once in Emacs can ramp up my M1's swap usage over 10 GB, not sure if swap is included when you say "memory".
I also have no idea why this is and I don't know how to debug swap usage. It hasn't been quite bothersome enough to bother looking into much, at least for me.
sameertj · 2022-06-10 15:37
I run Cider for Clojure and ClojureScript. But I have not seen the same issue when I run it on an Intel mac.
sameertj · 2022-06-10 15:38
>I run Cider for Clojure and ClojureScript. But I have not seen the same issue when I run it on an Intel mac.
onetom · 2022-06-10 15:55
you should look into tryin one of these variants on macOS:
1. https://github.com/d12frosted/homebrew-emacs-plus
2. https://github.com/railwaycat/homebrew-emacsmacport
DanTheDiscloser · 2022-06-10 15:58
where I get am m1 build of emacs?
onetom · 2022-06-10 16:02
you should look into tryin one of these variants on macOS:
1. https://github.com/d12frosted/homebrew-emacs-plus
2. https://github.com/railwaycat/homebrew-emacsmacport
they are still a bit of a mess, with different trade offs.
I used emacs-mac for about a year because it provides pixel precision scroll, but that one doesn't have purcell/exec-path-from-shell out of the box, neither has option for building the unstable (v29) version.
onetom · 2022-06-10 16:03
Egacs? :)
sameertj · 2022-06-10 16:08
thank you!
xircon · 2022-06-10 16:31
Run emacs with no config file (at work, either emacs -Q or -q can't remember!). If that is fine, then it is your config file.
wakatara · 2022-06-11 02:14
I'd recoemmend the d12frosted. Keep in mind you can also compile it from source if you want with homebrew and that should eliminate any issues with not believing it's M1 compatible. I run emacs fine on M1 (29.x branch) and have not had anything near your memory use, so I imagine it is something to do with your config and not emacs itself.
worthless-trash · 2022-06-11 11:20
brew should use the systems gcc right ? if gcc makes the aarch64 binaries, it will build emacs fo aarch64, so use brew.
DanTheDiscloser · 2022-06-11 13:07
Thank you.
sameertj · 2022-06-11 22:50
I attached a snapshot of the memory usage.
sameertj · 2022-06-11 22:51
I just attached a snapshot of the memory usage.
sameertj · 2022-06-11 23:01
I use the same config file on an Intel mac and there are no issues.
sameertj · 2022-06-11 23:02
Just running cider for Clojure and Clojurescript.
mmmnop000 · 2022-06-12 19:12
What does the output of `M-x memory-report` look like when this happens?
sameertj · 2022-06-12 19:38
Just the ran the command and it froze. As of now it was using around 18 GB of memory. I will have to restart it.
sameertj · 2022-06-19 00:38
After I ran memory report the emacs memory usage as shown on Activity Monitor came down to less that .5 gb. I assumed garbage collection of some kind was done when it ran.
So I found a temporary solution. I put this in my init script and this runs every 5 minutes. It seems to solve the issue for now.
(run-with-timer 0 300 'garbage-collect)
sameertj · 2022-06-19 00:41
I found a temporary solution to the issue. u/mmmnop000 suggested I run m-x memory-report.
After I ran memory report the emacs memory usage as shown on Activity Monitor came down to less that .5 gb. I assumed garbage collection of some kind was done when it ran.
I put this in my init script and this runs every 5 minutes. It seems to solve the issue for now.
(run-with-timer 0 300 'garbage-collect)