使用命令:
sysctl
sysctl vm.max_map_count 查看
sysctl -w vm.max_map_count=262144 临时操作,肯能重启后失效
To set this value permanently, update the vm.max_map_count
setting in /etc/sysctl.conf
. To verify after rebooting 永久操作
手册地址:
http://www.jinbuguo.com/man/sysctl.html
sysctl命令用于运行时配置内核参数,这些参数位于/proc/sys目录下
比如:/proc/sys/vm/max_map_count
linux参数之max_map_count,这个参数es under docker 有时候就会遇到
“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.”
max_map_count文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量。虚拟内存区域是一个连续的虚拟地址空间区域。在进程的生命周期中,每当程序尝试在内存中映射文件,链接到共享内存段,或者分配堆空间的时候,这些区域将被创建。调优这个值将限制进程可拥有VMA的数量。限制一个进程拥有VMA的总数可能导致应用程序出错,因为当进程达到了VMA上线但又只能释放少量的内存给其他的内核进程使用时,操作系统会抛出内存不足的错误。如果你的操作系统在NORMAL区域仅占用少量的内存,那么调低这个值可以帮助释放内存给内核用。
sysctl vm.max_map_count 查看
永久设置:
To set this value permanently, update the vm.max_map_count
setting in /etc/sysctl.conf
重启后验证
sysctl vm.max_map_count