TeMPOraL / nyan-mode

Nyan Cat for Emacs! Nyanyanyanyanyanyanyanyanyan!
GNU General Public License v3.0
794 stars 68 forks source link

Potential memory leak #30

Open dartzon opened 7 years ago

dartzon commented 7 years ago

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

TeMPOraL commented 7 years ago

Ouch, that's a serious one. Will take a look into it, thanks!

TeMPOraL commented 7 years ago

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.

TeMPOraL commented 7 years ago

Bump?

I run some tests on older and current release, and I couldn't replicate the effect over the day.

dartzon commented 7 years ago

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:

without_animation

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:

with_animation

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.

ksqsf commented 5 years ago

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.