felipec/notmuch-vim

memory leak

Closed this issue · 5 comments

Do you also get a memory leak after running NotMuchR for a while?

vim loads with 600MB resident at first, and then grows to 2GB easily within a few hours of casual use.

16:42 capslock:Documents/co/msp% ps auwx|grep vim
yeled          49529   0.2  0.0  2434892    548 s025  S+    4:47pm   0:00.01 grep vim
yeled          40445   0.0  0.1  2468056   8172 s002  S+   Tue12pm   0:02.04 vim bin/contentsearch.sh
yeled          37783   0.0  0.1  2468572   6984 s016  S+   Tue12pm   0:00.71 vim lib/msp/commands/definitions/ingestion.rb
yeled          35292   0.0  0.1  2468056   8044 s021  S+   Tue10am   0:00.53 vim views/index.erb views/layout.erb
yeled          35224   0.0  0.1  2500548   8768 s009  S+   Tue10am   0:06.58 vim main.rb
yeled          24205   0.0 24.8 22561960 3120560 s014  S+   12:09pm   4:32.09 vim -c :NotMuchR

I usually close and reopen this window, so I haven't seen that =/

How can I help find out what is bloated?

No idea. There may be some ruby options to do that. Also you can try to manually trigger garbage collection at some points (maybe even have a key binding) (GC.start I think), and set some variables to nil.

I spent a day trying to trigger memory leaks, and indeed there are some problems. Both of them can be fixed tracked down to issues in libnotmuch, and the Ruby bindings.

However, they can also be fixed in the notmuch-vim as well, so that's what I did and I pushed the result to the 'master' branch, please give it a try.

I also sent the patches for notmuch core, but I haven't heard anything back.

I'm marking this as closed, please comment if the problem remains.

There was a horrible bug in my previous attempt to get rid of the leaks, now it should be fixed and everything seems to work fine.