虚拟机可以使用多少内存 [英] How much memory could vm use
问题描述
我阅读了文档 了解虚拟内存 并说在Linux VM中更改可调参数的一种方法是命令:
I read the document Understanding Virtual Memory and it said one method for changing tunable parameters in the Linux VM was the command:
sysctl -w vm.max_map_count=65535
我想知道65535是什么意思,并且该设置可以使vm使用多少内存.
I want to know what the number 65535 means and how much memory could vm use by the setting.
推荐答案
来自 Linux内核文档 :
max_map_count:
max_map_count:
此文件包含一个进程的最大内存映射区域数 可能有.内存映射区域用作调用的副作用 malloc,直接由mmap和mprotect以及在加载共享时 库.
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.
虽然大多数应用程序需要少于一千张地图,但某些情况下 程序,尤其是malloc调试器,可能会消耗很多程序, 例如,每次分配最多一到两张地图.
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.
默认值为65536.
最底线:此设置限制了离散映射内存 areas 的 number -就其本身而言,它不限制那些 size 的大小进程可以使用的区域或内存.
Bottom line: this setting limits the number of discrete mapped memory areas - on its own it imposes no limit on the size of those areas or on the memory that is usable by a process.
是的,这是
sysctl -w vm.max_map_count=65535
只是一种更好的编写方式:
is just a nicer way of writing this:
echo 65535 > /proc/sys/vm/max_map_count
这篇关于虚拟机可以使用多少内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!