mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
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.
This commit is contained in:
@@ -540,10 +540,6 @@ EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
|
||||
#define FOR_ALL_BUFFERS_BACKWARDS(buf) \
|
||||
for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev)
|
||||
|
||||
/* Flag that is set when switching off 'swapfile'. It means that all blocks
|
||||
* are to be loaded into memory. Shouldn't be global... */
|
||||
EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */
|
||||
|
||||
/*
|
||||
* List of files being edited (global argument list). curwin->w_alist points
|
||||
* to this when the window is using the global argument list.
|
||||
|
Reference in New Issue
Block a user