Kunaljain's Weblog

September 27, 2009

Java Error – Error occurred during initialization of VM

Filed under: Java,Linux Tips & Tricks — Kunal Jain @ 08:21

While running Java i faced this problem

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

This error occur because java was not able to get enough Virtual Memory as i did ulimit -a on my linux machine and i found that the virtual memory and max memory size is limited on my machine.

so i change this to unlimited by editing limits.conf file which is located in /etc/security/limits.conf and now java is working fine.

ulimit -a before making changes in limits.conf file

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) 40960
max locked memory       (kbytes, -l) 32
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) 40960
virtual memory          (kbytes, -v) 524288
file locks                      (-x) unlimited

ulimit -a after making changes in limits.conf file

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) 40960
max locked memory       (kbytes, -l) 32
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) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 40960
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Advertisements

2 Comments »

  1. Hey, I found your blog while searching on Google your post looks very interesting for me. I will add a backlink and bookmark your site. Keep up the good work! 🙂

    Comment by RobD — October 6, 2009 @ 22:04 | Reply

  2. Hi,

    thanks for the great quality of your blog, every time i come here, i’m amazed.

    Comment by black hattitude — October 17, 2009 @ 05:46 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: