我的命令行java程序在分配有1GB RAM的双核CPU的Windows 10工作站上运行时工作。为什么我在Linux虚拟机上遇到内存不足错误,但它在正常的Windows 10上工作?
但是,当我在具有4个vCPU且具有12GB RAM的Ubuntu虚拟机上运行它时遇到内存不足错误。
两者都使用-Xms和-Xmx运行相应的值。
这是一个奇怪的错误。
更新: 1)我不能分享代码,不要声音傲慢或任何东西,但我认为代码没有问题。
2)错误如下:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 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=22403, tid=0x00007f52f9f2c700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 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
#
顺便说一句,我的虚拟机的最大内存12GB的是,我用-Xms12160m -Xmx12160m。 至于我的工作站,我的最大内存为2GB,但我用-Xms1024m -Xmx1024m
2016-07-26
Isaac
+5
很难帮助你而不看到一些代码。 –
+0
你能否提供一些额外的信息?像你的程序一样?或发布错误 –