简体   繁体   中英

Java: Error occurred during initialization of VM

I am trying to adjust ram sharing correctly but there is a problem. I tested some solutions from stackoverflow on my server but I achieved no result. When I run this command, there is no problem.

export _JAVA_OPTIONS='-Xms16m -Xmx64m'

Then I run java -version from command prompt:

Picked up _JAVA_OPTIONS: -Xms16m -Xmx64m
java version "1.7.0_95"
OpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-x86_64 u95-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

However, I want to increase size with this command but it cannot execute:

 export _JAVA_OPTIONS='-Xms16m -Xmx128m'

After above command, when I run java -version again, I have this error:

Picked up _JAVA_OPTIONS: -Xms16m -Xmx128m
Error occurred during initialization of VM
Cannot create VM thread. Out of system resources.

This is output of free -m :

             total       used       free     shared    buffers     cached
Mem:          2048        961       1086          6          0        397
-/+ buffers/cache:        564       1483
Swap:            0          0          0

If the problem is inability of RAM of my server, I upgraded to 2 gb from 1 gb before. How much longer do I have to upgrade it to run Java correctly? What should I do?

Edit:

Here is output of 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) 1030823
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) 524288
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) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1030823
virtual memory          (kbytes, -v) 524288
file locks                      (-x) unlimited

From your ulimit output looks like your virtual memory and Max memory size are set to almost half gigabyte, so no matter how much RAM you have this will limit you. Try to increase them read more here: http://www.unixarena.com/2013/12/how-to-increase-ulimit-values-in-redhat.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM