ubuntu中报错:无法分配内存 (errno=12)
今天碰到一个大坑,差点要了老命!
之前装了ubuntu双系统,后来崩溃,想在就想装VMware虚拟机,再装ubuntu,一切进展顺利,直到在虚拟机的ubuntu中安装IDEA时出现了问题。
安装过程并没有报错,但是启动后运行一个项目,项目还没加载呢就直接退出,生成个错误日志,如下:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000f5a9b000, 66166784, 0) failed; error=‘无法分配内存‘ (errno=12)
日志中的部分内容是:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 66166784 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2627), pid=3309, tid=0x00007f0174cfc700
#
# JRE version: OpenJDK Runtime Environment (8.0_112-b16) (build 1.8.0_112-release-736-b16)
# Java VM: OpenJDK 64-Bit Server VM (25.112-b16 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
真是走了很多弯路,尝试了无数次:重装idea,idea配置文件配置jvm的大小,把虚拟机的内存再调大一倍等等等等
最后来根据 (errno=12)这个搜索到一篇文章,说道:
后来看了美军一个文章(http://www.enchantedage.com/node/235),加一个配置即可:echo 1000000 > /proc/sys/vm/max_map_count
我看了自己虚拟机ubuntu里面,/proc/sys/vm/max_map_count的初始值很小,只有6w多,果断使用这个重设了一下。
啊,终于好了,太艰难了。
标签:虚拟机的ubuntu中安装Idea出错 无法分配内存 (errno=12)
原创文章,欢迎转载,转载请注明处!