Over on vim_use, in suggesting a solution to someone who wants to sort
blocks of text by their titles, I ran the following in vim 7.3.55:

:e $VIMRUNTIME/doc/eval.txt
:save /tmp/eval.txt
:v/^\d\+\. .*\*$/s/$/xyzzy
:g/xyzzy/-j!

With this vim's heap grew to 512 MiB, and my 1 GiB system swapped
somewhat for a while, and it ran at 100% of cpu for a long time,
having reported 8350 fewer lines.  I closed the window and vim let me
save the file.

If I issue :syntax off before joining the lines, the command completes
in a few seconds (if there's free memory) and does not run 100% cpu at
all.

So I see two problems:
1) Profligate memory use.  (I tried running with valgrind, and
reported 536,211,001 bytes in use at exit, but the same, minor leaks
as starting vim and immediately quitting.)  Perhaps this is really a
memory allocator deficiency, with vim repeatedly requesting slightly
larger blocks to accommodate the growing line, and the allocator
failing to consolidate the freed blocks.
2) Syntax colouring for vim help doesn't cope with very long lines.
Fair enough, one might say, but perhaps it could fail more gracefully.

I don't really expect anything much to happen about these; I spent
some time finding this stuff out so I thought I'd set it down, in case
it added to the picture helpfully.

(BTW, I followed with
:sort /\d\+\. /
:%s/xyzzy/\r/g
:g/^\d\+\. .*\*$/-m .
and it worked as intended.)

Regards, John

-- 
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

Raspunde prin e-mail lui