diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2016-03-09 19:34:28 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2017-04-11 00:33:09 +0200 |
commit | 9ea111d1af6abcac361eece478fb7709e5264b82 (patch) | |
tree | 503cd8775e8f53a5ee5827258a1ad5e88c0c01d3 /src/nvim/memfile_defs.h | |
parent | b99cac277812d337e8a5f1bc6a182e62f1e8c448 (diff) | |
download | rneovim-9ea111d1af6abcac361eece478fb7709e5264b82.tar.gz rneovim-9ea111d1af6abcac361eece478fb7709e5264b82.tar.bz2 rneovim-9ea111d1af6abcac361eece478fb7709e5264b82.zip |
Remove maxmem and maxmemtot options
> 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.
On today's systems these values are huge (4GB in my machine with 8GB of RAM
since it's set as half the available memory by default) 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
swapping mechanism. This is unnecessary and inefficient since the operating
system already virtualized the 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 'src/nvim/memfile_defs.h')
-rw-r--r-- | src/nvim/memfile_defs.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index b3c2f3564c..2402d2147d 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -56,7 +56,6 @@ typedef struct mf_hashtab { /// /// The used list is a doubly linked list, most recently used block first. /// The blocks in the used list have a block of memory allocated. -/// mf_used_count is the number of pages in the used list. /// The hash lists are used to quickly find a block in the used list. /// The free list is a single linked list, not sorted. /// The blocks in the free list have no block of memory allocated and @@ -95,8 +94,6 @@ typedef struct memfile { bhdr_T *mf_free_first; /// first block header in free list bhdr_T *mf_used_first; /// mru block header in used list bhdr_T *mf_used_last; /// lru block header in used list - unsigned mf_used_count; /// number of pages in used list - unsigned mf_used_count_max; /// maximum number of pages in memory mf_hashtab_T mf_hash; /// hash lists mf_hashtab_T mf_trans; /// trans lists blocknr_T mf_blocknr_max; /// highest positive block number + 1 |