Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting memory leaks #633

Closed
TatriX opened this issue Aug 27, 2019 · 8 comments
Closed

Detecting memory leaks #633

TatriX opened this issue Aug 27, 2019 · 8 comments

Comments

@TatriX
Copy link

TatriX commented Aug 27, 2019

My Emacs with EXWM slowly leaks memory.

while (true) { ps -h -p `pidof emacs` -O rss | awk '{print $2;}' | tee emacs.log; sleep 1 }

2019-08-27-135925_1447x1021_scrot

Any advices on how can I find what is leaking memory?

GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-23
EXWM commit d63dc6a
@TatriX
Copy link
Author

TatriX commented Aug 28, 2019

If I run the same Emacs configuration under awesome WM, it doesn't leak.
It seems that every time I switch workspace ~1Mb of memory is leaked.

@ch11ng
Copy link
Owner

ch11ng commented Sep 1, 2019

I do notice increasing memory usage here, but not after switching workspace. The cause is not clear to me. Now that you can reproduce this issue reliably, please take a took at various variables/functions described in (info "Garbage Collection") which show some internal statistics.

@TatriX
Copy link
Author

TatriX commented Sep 2, 2019

Will do, thanks!

@TatriX
Copy link
Author

TatriX commented Sep 2, 2019

BTW, running (garbage-collect) freezes my EXWM session.

@TatriX
Copy link
Author

TatriX commented Sep 2, 2019

It seems that the reason why it's eating so much memory in my case is this:

;; Disable GC for startup. It will be restored in after-init-hook.
(setq gc-cons-threshold most-positive-fixnum)
(add-hook 'after-init-hook
          (lambda ()
              (setq gc-cons-threshold 800000))

@TatriX TatriX closed this as completed Sep 3, 2019
@ch11ng
Copy link
Owner

ch11ng commented Sep 8, 2019

But isn't gc-cons-threshold restored eventually?

@TatriX
Copy link
Author

TatriX commented Sep 9, 2019

It is in after-init-hook. But for some reason collections do not happen afterwards. After I've removed that piece of code from my init file it became much better. Still sometimes Emacs's memory usage slowly grows to a bigger numbers. I will investigate it a bit more and if I find anything, I'll reopen this issue.

@TatriX
Copy link
Author

TatriX commented Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants