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 ...
随机推荐
- arcgis访问百度地图
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- 常用命令4-文件搜索命令 2- whereis
whereis比较局限,只能查看系统命令.
- Python 运算符括号
- 如何用SPSS分析学业情绪量表数据
如何用SPSS分析学业情绪量表数据 1.数据检验.由于问卷.量表的题目是主观判断和选择,因而难免有些人不认真填,所以,筛选出有效.高质量的数据非常关键.通常需要作如下检查:(1)是否有人回答互相矛盾, ...
- Directx11教程(8) 一个新的camera类
原文:Directx11教程(8) 一个新的camera类 本章我们将替换掉CameraClass类,实现一个稍微靠谱点的摄像机类.并通过Q,W,E,A,S,D,Z,X,C等按键实现摄像机的 ...
- PHPCMS快速建站系列之phpcms v9 模板标签说明整理
[摘要]本文介绍phpcms v9中模板标签使用说明. {template "content","header"} 调用根目录下phpcms\template\ ...
- (译)Objective-C的动态特性
这是一篇译文,原文在此,上一篇文章就是受这篇文章启发,这次干脆都翻译过来. 过去的几年中涌现了大量的Objective-C开发者.有些是从动态语言转过来的,比如Ruby或Python,有些是从强类型 ...
- 大话鸿蒙操作系统(一)-- 先聊聊 Fuchsia OS
大话鸿蒙操作系统(一) 第一篇先不聊鸿蒙操作系统,聊聊 Google 的新系统 Fuchsia OS. 先看看 Fuchsia OS 介绍. 为什么 Google 要造新的 Fuchsia OS 操作 ...
- linux查看用户组所有成员
1.grep 'user1' /etc/group //找出用户组的gid user1:x:1004://得出gid=1004 2. awk -F":" '{print $1&qu ...
- 《C程序设计语言》笔记(三)
六:结构 1:结构体声明中,比如: struct point{ int x; int y; }; struct后面的名字是可选的,称为结构标记.结构成员.结构标记和普通变量可以采用相同的名字,它们之间 ...