Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory
遇到问题
在服务器上运行 nexus 出现Native memory allocation (mmap) failed to map 838860800 bytes for committing reserved memory
问题。
原因:查资料后是因为运行 nexus 需要 800m 的内存,而机器配置是1G,剩余可用的只有几十兆,所以导致无法启动
解决办法
方法一: 扩大机器配置;
方法二: 设置交换内存swap(一般设置为内存的两倍大小);
dd if=/dev/zero of=/tmp/swapfile bs=1024k count=256
#格式化文件
mkswap /tmp/swapfile
#加载交换文件
swapon /tmp/swap
#永久生效
vim /etc/fstab
#最后一行添加
/swap1 swap swap defaults 0 0
方法三:设置虚拟机的启动参数
# Xms: 初始化堆内存(heap)
# Xmx: 最大堆内存
# PermSize: 初始化永久内存,存储class类,不会被GC
# MaxPermSize: 最大永久内存
# Xss: 每增加一个线程(thread)就会立即消耗的内存,而最佳值应该是128K,默认值好像是512
JAVA_OPTS=-Xss128k -Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=1024m
在这里补充下堆和栈的区别(这个堆和栈不是数据结构的堆和栈)
栈中分配局部变量空间,堆区是向上增长的用于分配程序员申请的内存空间。另外还有静态区是分配静态变量,全局变量空间的;只读区是分配常量和程序代码空间的;以及其他一些分区。
来看一个网上很流行的经典例子:
main.cpp
int a = 0; 全局初始化区
char *p1; 全局未初始化区
main()
{
int b; 栈
char s[] = “abc”; 栈
char *p2; 栈
char *p3 = “123456”; 123456\0在常量区,p3在栈上。
static int c =0; 全局(静态)初始化区
p1 = (char *)malloc(10); 堆
p2 = (char *)malloc(20); 堆
}
关于堆和栈区别的比喻
堆和栈的区别可以引用一位前辈的比喻来看出:
使用栈就象我们去饭馆里吃饭,只管点菜(发出申请)、付钱、和吃(使用),吃饱了就走,不必理会切菜、洗菜等准备工作和洗碗、刷锅等扫尾工作,他的好处是快捷,但是自由度小。
使用堆就象是自己动手做喜欢吃的菜肴,比较麻烦,但是比较符合自己的口味,而且自由度大。
原文地址:https://blog.csdn.net/byg184244735/article/details/79832217
Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory的更多相关文章
- Linux下TomcatVM参数修改:Native memory allocation (mmap) failed to map 3221225472 bytes for committing reserved memory.
不可行的方法最初我直接修改catalina.sh, 将JAVA_OPTS变量加上了 -server -Xms1G -Xmx1G -XX:+UserG1GC最初看起来没啥问题,但是当服务器运行几天后,发 ...
- Native memory allocation (mmap) failed to map 142606336 bytes for committing reserved memory.
这里写链接内容 问题描述 Java程序运行过程中抛出java.lang.OutOfMemoryError: unable to create new native thread,如下所示: [java ...
- linux 下tomcat出现 Native memory allocation (malloc) failed to allocate 1915224064 bytes for committing reserved memory问题
## There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocat ...
- C++ TUTORIAL - MEMORY ALLOCATION - 2016
http://www.bogotobogo.com/cplusplus/memoryallocation.php Variables and Memory Variables represent st ...
- Memory Allocation with COBOL
Generally, the use of a table/array (Static Memory) is most common in COBOL modules in an applicatio ...
- PatentTips - Modified buddy system memory allocation
BACKGROUND Memory allocation systems assign blocks of memory on request. A memory allocation system ...
- Attempt to fetch logical page (...) in database 2 failed. It belongs to allocation unit xxxx not to xxx
今天一个同事说在一个生产库执行某个存储过程,遇到了错误: Fatal error 605 occurred at jul 29 2014 我试着执行该存储过程,结果出现下面错误,每次执行该存储过程,得 ...
- Memory Allocation API In Linux Kernel && Linux Userspace、kmalloc vmalloc Difference、Kernel Large Section Memory Allocation
目录 . 内核态(ring0)内存申请和用户态(ring3)内存申请 . 内核态(ring0)内存申请:kmalloc/kfree.vmalloc/vfree . 用户态(ring3)内存申请:mal ...
- [bug]WCF 内存入口检查失败 Memory gates checking failed
bug描述 异常信息:内存入口检查失败,因为可用内存(xxx 字节)少于总内存的 xx%.因此,该服务不可用于传入的请求.若要解决此问题,请减少计算机上的负载,或调整 serviceHostingEn ...
随机推荐
- 【51nod1563】坐标轴上的最大团 贪心
题面 坐标轴上有n个点,每个点有一个权值.第i个点的坐标是 xi ,权值是 wi .现在对这些点建图.对于点对 (i,j) ,如果 \(|xi−xj|≥wi+wj\) ,那么就给第i个点和第j个点之间 ...
- 【JZOJ4711】【NOIP2016提高A组模拟8.17】Binary
题目描述 输入 输出 样例输入 6 6 8 9 1 13 9 3 1 4 5 2 6 9 1 3 7 2 7 7 1 6 1 2 11 13 样例输出 45 19 21 数据范围 解法 40%暴力即可 ...
- PHP原生DOM对象操作XML的方法解答
创建一个新的XML文件,并且写入一些数据到这个XML文件中. /** 创建xml文件*/ $info = array(array('obj' => 'power','info' => 'p ...
- bootStrap表单验证插件的使用
bootStrapValidator插件的使用 1.插件的下载和引用 首先要引入bootstrapValidator插件.链接的地址:https://www.bootcdn.cn/jquery.boo ...
- Objectarx之分批存储相连实体
void CCommonFuntion::BatchStorageEnt(AcDbObjectIdArray& inputId, std::vector<std::vector<A ...
- apply( )与 call( ) 的区别
JavaScript中的每一个Function对象都有一个apply()方法和一个call()方法 语法 /*apply()方法*/ function.apply(thisObj[, argArray ...
- php输入流简单小例子
<form method="post" action="index.php/home/index/captchaTest"> <input n ...
- OpenJudge_1936:All in All
描述 You have devised a new encryption technique which encodes a message by inserting between its char ...
- HDU_1061:Rightmost Digit
Problem Description Given a positive integer N, you should output the most right digit of N^N. Inp ...
- 测试安装phpmyadmin4.0
在测试环境准备测试安装phpmyadmin,测试环境上为一台zabbix 3.4的服务器,已经安装lamp环境. 根据安装文档,从phpmyadmin官网上下载了4.0版本,复制到/var/www/h ...