On Tuesday, August 26, 2014 12:20:44 AM UTC-5, mattn wrote: > Hi list. > > When vim allocate many objects, some times vim hang for GC. Ariya Mizutani > suggested below's patch. > > https://gist.github.com/mattn/0c58a7398c63ab4c3066 > > Try following test code. > ---------------------------------------------- > let s:hoge = {} > let s:fuga = {} > let s:arr = [] > > function! Prepare() abort " {{{ > let s:hoge.a1 = map(range(1, 50000), '{}') > let s:hoge.a2 = map(range(1, 50000), '{}') > let s:hoge.a3 = map(range(1, 50000), '{}') > let s:hoge.fuga = s:fuga > let s:fuga.hoge = s:hoge > endfunction " }}} > > function! Release() abort " {{{ > let s:arr = s:hoge.a2 > unlet s:hoge > unlet s:fuga > endfunction " }}} > > let start = reltime() > call Prepare() > call Release() > call garbagecollect() > echomsg string(reltimestr(reltime(start))) > ---------------------------------------------- > > Without this patch, it take 100 seconds to finish GC. And if set 100000 > instead of 50000, vim often hangs. With this patch, it take just 0.133967 > seconds. This patch avoid linear-search for freeing items. > I think this is awesome patch for vim because people uses many plugins > recently. > I tried this patch few days. I don't see any problems. > > Thanks. > - Yasuhiro Matsumoto
Cool! I'll try that out alongside my patch fixing the unlimited recursion in the garbage collector code, it looks like it should be compatible: https://groups.google.com/d/topic/vim_dev/dnN58kO5Vg4/discussion I need to get around to adding in code for LUA before it's ready :-( If someone wants to add that in for me I won't object, I'll probably be another couple weeks before I find time again. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
