Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs Slow and Lags Often - How to debug?

Tags:

emacs

My Emacs lags a lot sometimes. It seems like its after I invoke certain plugins but I am not sure. I've optimised my startup time, such that it autoloads them.

Sometimes, it takes a few seconds for it do what I typed and in other instances, it just goes to the background and when I open it, it crashes and core dumps. The output of the dump is usually some C function that crashed.

How can I debug the performance during runtime, and pinpoint which libraries are the cause? It could be a memory leak, but again, I have no clue.

I suspect its either the expand-region plugin or the grizzl plugin.

I run Emacs 24 in terminal on OS X.

Any help would be much appreciated!

like image 675
darksky Avatar asked Aug 14 '14 22:08

darksky


1 Answers

I suggest you try M-x profiler-start RET RET, then reproduce the slow behavior (maybe even a few times, since this is a sampling-based profiler), then M-x profiler-report RET. Then C-u RET on the first entry should hopefully show you where time is spent.

As for the crash: any crash is a very likely sign of a bug in Emacs, so M-x report-emacs-bug.

like image 118
Stefan Avatar answered Sep 19 '22 11:09

Stefan