我阅读了文档Understanding Virtual Memory它说在 Linux VM 中更改可调参数的一种方法是命令:
sysctl -w vm.max_map_count=65535
我想知道数字 65535 的含义以及该设置可以使用多少内存。
请您参考如下方法:
来自the Linux kernel documentation :
max_map_count:
This file contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap and mprotect, and also when loading shared libraries.
While most applications need less than a thousand maps, certain programs, particularly malloc debuggers, may consume lots of them, e.g., up to one or two maps per allocation.
The default value is 65536.
底线:此设置限制离散映射内存区域的数量 - 就其本身而言,它对这些区域的大小没有限制进程可用的区域或内存。
是的,这个:
sysctl -w vm.max_map_count=65535
只是一种更好的写法:
echo 65535 > /proc/sys/vm/max_map_count