Tuesday, February 13, 2018

Re: Will vim copy all file content to memory when i open a file?

On 13/02/2018 03:15, Tony Mechelynck wrote:
> On Tue, Feb 13, 2018 at 2:41 AM, Matt Ackeret <mattack@apple.com> wrote:
>> On Sun, 11 Feb 2018, Zhigang Song wrote:
>>> Will vim copy all file content to memory when I open a file?
>>
>> No, that's why vim is fast opening gigantic files.
>
> However, unlike sed, Vim is not a stream editor (i.e. an editor which
> processes the file in sequence from beginning to end, writing the
> output at the same time). Vim edits its file(s) in whatever sequence
> the user moves the cursor, writes it only for :w :x or similar, and
> for that it "prefers" to hold the whole file in memory, and it will do
> so as long as each buffer is small in comparison to 'maxmem' and all
> buffers combined in comparison to 'maxmemtot'. On my 64-bit system,
> Vim sets both these options by default to 4021798 (a little under 4
> GiB which would be 4194304 KiB, and exactly half the value on the
> MemTotal line of /proc/meminfo).
In my system (macOS and Vim 8.0.1500), if I run `vim --clean`
repeatedly, both maxmem and maxmemtot are set to the same huge value,
which changes at every run, such as 9007199253926612 or
9007199253919906. I wish that were approx. half the KB of my RAM
but alas it is not. Are those normal values to see?

Life.



--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: