nyan-mode
nyan-mode copied to clipboard
Potential memory leak
I think there is a memory leak if the animation is activated. I opened emacs and just left it inactive while I was watching its memory consumption and it was eating memory gradually. In my office desktop where I only have 8GB of RAM, Linux reached the memory limits and stopped responding. I disabled the Nyan-mode's animations and emacs stoped eating my RAM like a crazy
Ouch, that's a serious one. Will take a look into it, thanks!
Also, please evaluate the following in your *scratch* buffer, using e.g. M-x eval-print-last-sexp
, and paste the results.
(garbage-collect)
You should get something along the lines of:
((conses 16 1035913 70711) (symbols 48 62970 29) (miscs 40 1403 901) (strings 32 173411 26415) (string-bytes 1 5061273) (vectors 16 155388) (vector-slots 8 4447830 134522) (floats 8 22616 4024) (intervals 56 3297 1840) (buffers 976 16) (heap 1024 122484 6981))
If you get NIL
, it means GC in your Emacs isn't running.
Bump?
I run some tests on older and current release, and I couldn't replicate the effect over the day.
Hello, I'm sorry for my late reply.
My Emacs's GC is working properly here is the output of your command:
((conses 16 273754 170064) (symbols 48 34429 119) (miscs 40 63 189) (strings 32 63496 139337) (string-bytes 1 1788797) (vectors 16 30788) (vector-slots 8 649339 123779) (floats 8 373 550) (intervals 56 89 218) (buffers 976 14))
And here is my configuration for the Nyan-mode:
(require 'nyan-mode) (when (display-graphic-p) (setq-default nyan-animate-nyancat t) (setq-default nyan-wavy-trail t) (setq-default nyan-minimum-window-width 100) ) (nyan-mode 1) (nyan-start-animation)
Now, if I remove the (nyan-start-animation)
instruction and start Emacs and let it idle, the memory usage begins at 54.1 MB and stays like that forever:
But with the (nyan-start-animation)
instruction, Emacs started at 54.8 MB and after 10 minutes the memory consumption reached 1GiB, while Emacs was totally idle with 0 opened buffers in it:
I am using Emacs 25.1.1 and nyan-mode package version 20160429.1323 from Melpa.
If you need more information I'll be glad to provide answers.
I can confirm that the RAM consumption keeps growing for a while, until I call (garbage-collect)
manually. Some time later, the RAM consumption grows again. I suspect this is due to Emacs' conservative GC policy, but I'm not familiar with Emacs enough to debug this.
edit: I have (setq gc-cons-threshold 100000000)
.
edit 2: Can't reproduce on emacs -q
.