zoukankan      html  css  js  c++  java
  • linux参数之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.”

           max_map_count文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量。虚拟内存区域是一个连续的虚拟地址空间区域。在进程的生命周期中,每当程序尝试在内存中映射文件,链接到共享内存段,或者分配堆空间的时候,这些区域将被创建。调优这个值将限制进程可拥有VMA的数量。限制一个进程拥有VMA的总数可能导致应用程序出错,因为当进程达到了VMA上线但又只能释放少量的内存给其他的内核进程使用时,操作系统会抛出内存不足的错误。如果你的操作系统在NORMAL区域仅占用少量的内存,那么调低这个值可以帮助释放内存给内核用。

    调整示例,如下调整为默认的4倍

    此操作需要root权限

    [root@localhost ~]# sysctl -w vm.max_map_count=262144

    查看修改结果

    [root@localhost ~]# sysctl -a|grep vm.max_map_count
    vm.max_map_count = 262144
     
  • 相关阅读:
    vector::reserve()对迭代器的影响
    C#日期格式转换大全
    aa
    C#中取到当前日期是在一年中的第几周
    EasyUI
    使用Ajax传递 json数据,并在一般处理页面进行接收全过程
    C#操作海量数据(Oracle、SQL Server)
    UE4教程
    游戏引擎的原理及应用
    C++基础02 (数组、函数、指针、结构体)
  • 原文地址:https://www.cnblogs.com/duanxz/p/3567068.html
Copyright © 2011-2022 走看看