mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 19:18:34 +00:00
Remove HAVE_TOTAL_MEM
libuv provide uv_get_total_mem_kib. So HAVE_TOTAL_MEM should always be true. Before that commit in neovim maxmem=5120 and maxmemtot=10240. Now both equal to half of system memory.
This commit is contained in:
@@ -1933,26 +1933,15 @@ void set_init_1(void)
|
|||||||
*/
|
*/
|
||||||
opt_idx = findoption((char_u *)"maxmemtot");
|
opt_idx = findoption((char_u *)"maxmemtot");
|
||||||
if (opt_idx >= 0) {
|
if (opt_idx >= 0) {
|
||||||
#ifndef HAVE_TOTAL_MEM
|
|
||||||
if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TOTAL_MEM
|
|
||||||
/* Use half of amount of memory available to Vim. */
|
/* Use half of amount of memory available to Vim. */
|
||||||
/* If too much to fit in long_u, get long_u max */
|
/* If too much to fit in long_u, get long_u max */
|
||||||
uint64_t available_kib = os_get_total_mem_kib();
|
uint64_t available_kib = os_get_total_mem_kib();
|
||||||
n = available_kib / 2 > ULONG_MAX ? ULONG_MAX
|
n = available_kib / 2 > ULONG_MAX ? ULONG_MAX
|
||||||
: (long_u)(available_kib /2);
|
: (long_u)(available_kib /2);
|
||||||
#else
|
|
||||||
n = (0x7fffffff >> 11);
|
|
||||||
#endif
|
|
||||||
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
||||||
opt_idx = findoption((char_u *)"maxmem");
|
opt_idx = findoption((char_u *)"maxmem");
|
||||||
if (opt_idx >= 0) {
|
if (opt_idx >= 0) {
|
||||||
#ifndef HAVE_TOTAL_MEM
|
|
||||||
if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n
|
|
||||||
|| (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
|
|
||||||
#endif
|
|
||||||
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user