diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-05-02 10:09:51 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-05-02 10:14:42 +0200 |
commit | e46534b4230242c0d41831cc7ad16863c976b151 (patch) | |
tree | 218e0d6c4b9cfc0765052755b4518bf16eafe8aa /runtime | |
parent | c9e340b7be021b25485dff58059bfb5bdaed8e51 (diff) | |
parent | d0b08f32f56c39df484ca10c6c928596548ad8f6 (diff) | |
download | rneovim-e46534b4230242c0d41831cc7ad16863c976b151.tar.gz rneovim-e46534b4230242c0d41831cc7ad16863c976b151.tar.bz2 rneovim-e46534b4230242c0d41831cc7ad16863c976b151.zip |
Merge #4486 'refactor: Remove maxmem, maxmemtot options'
After this change we never release blocks from memory (in practice it
never happened because the memory limits are never reached). Let the OS
take care of that.
---
On today's systems the 'maxmem' and 'maxmemtot' values are huge (4+ GB)
so the limits are never reached in practice, but Vim wastes a lot of
time checking if the limit was reached.
If the limit is reached Vim starts saving pieces of the swap file that were in
memory to the disk. Said in a different way: Vim implements its own
memory-paging mechanism. This is unnecessary and inefficient since the
operating system already has virtual memory and will swap to the disk if
programs start using too much memory.
This change does...
1. Reduce the number of config options and need for documentation.
2. Make the code more efficient as we don't have to keep track of memory
usage nor check if the memory limits were reached to start swapping
to disk every time we need memory for buffers.
3. Simplify the code. Once memfile.c is simple enough it could be
replaced by actual operating system memory mapping (mmap,
MemoryViewOfFile...). This change does not prevent Vim to recover
changes from swap files since the swapping code is never triggered
with the huge limits set by default.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/options.txt | 24 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 2 | ||||
-rw-r--r-- | runtime/doc/recover.txt | 6 | ||||
-rw-r--r-- | runtime/doc/usr_11.txt | 2 | ||||
-rw-r--r-- | runtime/doc/vi_diff.txt | 12 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 2 | ||||
-rw-r--r-- | runtime/optwin.vim | 4 |
7 files changed, 4 insertions, 48 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a63bef5622..1f880eeb36 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3924,16 +3924,6 @@ A jump table for the options with a short description can be found at |Q_op|. because the 'w' is used before the next mapping is done. See also |key-mapping|. - *'maxmem'* *'mm'* -'maxmem' 'mm' number (default between 256 to 5120 (system - dependent) or half the amount of memory - available) - global - Maximum amount of memory (in Kbyte) to use for one buffer. When this - limit is reached allocating extra memory for a buffer will cause - other memory to be freed. The maximum usable value is about 2000000. - Use this to work without a limit. Also see 'maxmemtot'. - *'maxmempattern'* *'mmp'* 'maxmempattern' 'mmp' number (default 1000) global @@ -3947,20 +3937,6 @@ A jump table for the options with a short description can be found at |Q_op|. "\(.\)*" on a very long line. ".*" works much better. Vim may run out of memory before hitting the 'maxmempattern' limit. - *'maxmemtot'* *'mmt'* -'maxmemtot' 'mmt' number (default between 2048 and 10240 (system - dependent) or half the amount of memory - available) - global - Maximum amount of memory in Kbyte to use for all buffers together. - The maximum usable value is about 2000000 (2 Gbyte). Use this to work - without a limit. - On 64 bit machines higher values might work. But hey, do you really - need more than 2 Gbyte for text editing? Keep in mind that text is - stored in the swap file, one can edit files > 2 Gbyte anyway. We do - need the memory to store undo info. - Also see 'maxmem'. - *'menuitems'* *'mis'* 'menuitems' 'mis' number (default 25) global diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index a0ca17cc4a..7067c60d2f 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -768,9 +768,7 @@ Short explanation of each option: *option-list* 'maxcombine' 'mco' maximum nr of combining characters displayed 'maxfuncdepth' 'mfd' maximum recursive depth for user functions 'maxmapdepth' 'mmd' maximum recursive depth for mapping -'maxmem' 'mm' maximum memory (in Kbyte) used for one buffer 'maxmempattern' 'mmp' maximum memory (in Kbyte) used for pattern search -'maxmemtot' 'mmt' maximum memory (in Kbyte) used for all buffers 'menuitems' 'mis' maximum number of items in a menu 'mkspellmem' 'msm' memory used before |:mkspell| compresses the tree 'modeline' 'ml' recognize modelines at start or end of file diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt index 0533157072..ffea514870 100644 --- a/runtime/doc/recover.txt +++ b/runtime/doc/recover.txt @@ -63,10 +63,8 @@ following ones in your vimrc: This is also very handy when editing files on floppy. Of course you will have to create that "tmp" directory for this to work! -For read-only files, a swap file is not used. Unless the file is big, causing -the amount of memory used to be higher than given with 'maxmem' or -'maxmemtot'. And when making a change to a read-only file, the swap file is -created anyway. +For read-only files, a swap file is not used right away. The swap file is +created only when making changes. The 'swapfile' option can be reset to avoid creating a swapfile. And the |:noswapfile| modifier can be used to not create a swapfile for a new buffer. diff --git a/runtime/doc/usr_11.txt b/runtime/doc/usr_11.txt index 42009519df..42aa1d9100 100644 --- a/runtime/doc/usr_11.txt +++ b/runtime/doc/usr_11.txt @@ -294,8 +294,6 @@ If you really don't want to see this message, you can add the 'A' flag to the disk. 'updatetime' Timeout after which the swap file is flushed to disk. 'directory' List of directory names where to store the swap file. -'maxmem' Limit for memory usage before writing text to the swap file. -'maxmemtot' Same, but for all files in total. ============================================================================== diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index 917e0e6f80..139cd3749a 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -38,18 +38,6 @@ Information for undo and text in registers is kept in memory, thus when making undo levels and the text that can be kept in registers. Other things are also kept in memory: Command-line history, error messages for Quickfix mode, etc. -Memory usage limits -------------------- - -The option 'maxmem' ('mm') is used to set the maximum memory used for one -buffer (in kilobytes). 'maxmemtot' is used to set the maximum memory used for -all buffers (in kilobytes). The defaults depend on the system used. -These are not hard limits, but tell Vim when to move text into a swap file. -If you don't like Vim to swap to a file, set 'maxmem' and 'maxmemtot' to a -very large value. The swap file will then only be used for recovery. If you -don't want a swap file at all, set 'updatecount' to 0, or use the "-n" -argument when starting Vim. - ============================================================================== 2. The most interesting additions *vim-additions* diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 3575a420b7..6ec8220db6 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -402,6 +402,8 @@ Other options: *'imactivatekey'* *'imak'* *'imstatusfunc'* *'imsf'* *'macatsui'* + 'maxmem' Nvim delegates memory-management to the OS. + 'maxmemtot' Nvim delegates memory-management to the OS. *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'* 'shelltype' *'shortname'* *'sn'* *'noshortname'* *'nosn'* diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 13d0db0390..81eb3f11fd 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -996,10 +996,6 @@ call append("$", "updatecount\tnumber of characters typed to cause a swap file u call append("$", " \tset uc=" . &uc) call append("$", "updatetime\ttime in msec after which the swap file will be updated") call append("$", " \tset ut=" . &ut) -call append("$", "maxmem\tmaximum amount of memory in Kbyte used for one buffer") -call append("$", " \tset mm=" . &mm) -call append("$", "maxmemtot\tmaximum amount of memory in Kbyte used for all buffers") -call append("$", " \tset mmt=" . &mmt) call <SID>Header("command line editing") |