ubuntu上的Java内存不足,但存在大量缓存内存

我有一个带4GB RAM的ubuntu 14.04系统,x86_64 3.13.0-48通用内核和openjdk-7. 我的记忆用法如下: # free -h total used free shared buffers cachedMem: 3.7G 3.6G 127M

我有一个带4GB RAM的ubuntu 14.04系统,x86_64 3.13.0-48通用内核和openjdk-7.

我的记忆用法如下:

# free -h
             total       used       free     shared    buffers     cached
Mem:          3.7G       3.6G       127M       988M        44M       3.3G
-/+ buffers/cache:       232M       3.4G
Swap:           0B         0B         0B

因此,有足够的内存用作磁盘缓存,当任何应用程序需要时,应该刷新和释放(AFAIK).

所以,我尝试运行java:

# java -Xms32m -Xmx512m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

只运行java -version会返回相同的结果.当有3GB的缓存内存时,为什么java不能运行?我在同一台机器上运行PostreSQL,但它的shared_buffers设置为940MB.

编辑:

我强制刷新磁盘缓存 – 仍然是相同的结果:

# free -h
             total       used       free     shared    buffers     cached
Mem:          3.7G       1.9G       1.8G       988M        35M       1.7G
-/+ buffers/cache:       196M       3.5G
Swap:           0B         0B         0B
# java -Xms32m -Xmx512m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

EDIT2:

这是ulimit -a:

# ulimit -a
core file size          (blocks,-c) 0
data seg size           (kbytes,-d) unlimited
scheduling priority             (-e) 0
file size               (blocks,-f) unlimited
pending signals                 (-i) 30034
max locked memory       (kbytes,-l) 64
max memory size         (kbytes,-m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes,-p) 8
POSIX message queues     (bytes,-q) 819200
real-time priority              (-r) 0
stack size              (kbytes,-s) 32000
cpu time               (seconds,-t) unlimited
max user processes              (-u) 30034
virtual memory          (kbytes,-v) unlimited
file locks                      (-x) unlimited

EDIT3:

我完全没有得到它:我试图添加4GB交换,结果是它工作,虽然没有使用交换:

# free -h
             total       used       free     shared    buffers     cached
Mem:          3.7G       3.5G       196M       988M        44M       3.2G
-/+ buffers/cache:       239M       3.4G
Swap:         4.0G         0B       4.0G
# java -version
java version "1.6.0_36"
OpenJDK Runtime Environment (IcedTea6 1.13.8) (6b36-1.13.8-0ubuntu1~14.04)
OpenJDK 64-Bit Server VM (build 23.25-b01,mixed mode)

你需要运行一些东西.

喜欢

java -Xmx1024m -cp /path/to/jar/ com.project.Start

作者: dawei

【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部