spacehammer icon indicating copy to clipboard operation
spacehammer copied to clipboard

Memory leak

Open mattiaslundberg opened this issue 4 years ago • 9 comments

I regularly see high memory usage from Hammerspoon when running spacehammer (more than 1GB). I have seen this at two different machines (intel and m1 macbooks) running the default config or this config.

Tested on macos 11.1 and 11.2, hammerspoon 0.9.82 and spacehammer 7d9ffe1a0d338f71e28b0cf54cdc7e24848b4092.

From what I can see the memory usage increases about 1MB when running Option-SPC a e a single time and never decreases after. Reloading the hammerspoon config from the console releases some memory, but not all. Only solution I've found is to fully restart hammerspoon to release the memory.

I don't know if this issue is in spacehammer/fennel/hammerspoon/something else but starting here if anyone has ideas on how to proceed!

mattiaslundberg avatar Feb 04 '21 08:02 mattiaslundberg

when running Option-SPC a e

you mean when switching to Emacs? I do use that functionality all the time, but haven't noticed anything bad.

Thanks for the reporting it. This doesn't sound good. I'll keep an eye on that.

agzam avatar Feb 05 '21 05:02 agzam

I have not noticed this issue either. My memory usage seems to hover around 165 MB even after running for a couple of weeks. I'll check again in a few days to see where it's at. Thanks for reporting as well.

jaidetree avatar Feb 05 '21 06:02 jaidetree

Same here. Hammerspoon memory usage goes up to 1.4GB. Seems the issue is related to switching apps.

dangom avatar Mar 19 '21 21:03 dangom

Which method of app switching?

  • through LEAD a menu,
  • or via the common-keys, set by default to Option n/p

The second method uses https://www.hammerspoon.org/docs/hs.window.switcher.html. Do you use that a lot?

agzam avatar Mar 20 '21 22:03 agzam

Through LEAD a menu, though I do use both methods. I can't say I used that a lot, since I installed spacehammer for the first time yesterday and only used it for a couple of hours until my Mac slowed down and I noticed the memory issue.

dangom avatar Mar 21 '21 03:03 dangom

@dangom would you mind pulling the latest? Let me know if you still see it eating up too much. Thanks!

agzam avatar Mar 27 '21 00:03 agzam

Still seeing the same issue after the attempted fix :(

mattiaslundberg avatar Mar 27 '21 08:03 mattiaslundberg

Damn. I guess, I'll keep digging. Thank you for testing it out.

agzam avatar Mar 28 '21 19:03 agzam

I think this is probably the upstream issue in Hammerspoon. Searching for "memory" in the repo shows a few issues that look somewhat relevant. This one might be related https://github.com/Hammerspoon/hammerspoon/issues/2729

agzam avatar Mar 28 '21 20:03 agzam

Close this? I've never seen it, it's probably fixed upstream, and almost definitely irrelevant to us.

Grazfather avatar Apr 21 '23 05:04 Grazfather