vm 可以使用多少内存 [英] How much memory could vm use

查看:25
本文介绍了vm 可以使用多少内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了文档了解虚拟内存 它说在 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,加载shared时也是图书馆.

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.

The default value is 65536.

底线:此设置限制了离散映射内存区域数量 - 就其本身而言,它对那些大小没有限制区域或进程可用的内存上.

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

只是一种更好的写法:

echo 65535 > /proc/sys/vm/max_map_count

这篇关于vm 可以使用多少内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆