Reputation: 21049
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!
Upvotes: 16
Views: 4996
Reputation: 28571
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
.
Upvotes: 22
Reputation:
Do M-x toggle-debug-on-quit
, and then hit C-g
during the next lag. You'll get a backtrace that includes the command/function being evaluated at this time, and typically there's some suspicious function whose name gives the plugin away, which causes the lags.
Upvotes: 9