On Mon, May 05, 2014 at 05:23:03PM -0400, Carlos Santos wrote: > I work for Red Hat as a software maintenance engineer. Recently one of > our customers reported a crazy situation in which really BIG server > ran out of memory due to VIM's undo feature. Some user in their > environment did a global search and replace ( :%s/\n/,/g ) against a > file that had 59 Million lines. The operation consumed more than 100 > GB of memory and they had to reboot the machine in order to restore > normal functionality.
There was a discussion[0] about a related issue recently. The specific case of “:%s/\n//” was addressed in 7.4.232, but a more general solution hasn't been implemented yet. [0]: http://mid.gmane.org/[email protected] > 1. Is there a formula that a single search-and-replace consumes x memory? Is > this documented anywhere? This specific category of replacement ("replace \n with ...") has pathological behavior, since it "touches" the entire buffer. Yukihiro commented in the above thread that “undo memory is about m * (((n + 1) * n / 2) - 1), where n is number of lines and m is line length”. There's a suggested patch in that thread and an item in the todo list, but nothing else yet. Cheers, -- James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]> -- -- 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.
