0

vmstat gives:

swap        free
37489684    110178592

Still I have issues, while trying to run Java process with 10g heap:

> java -Xmx10g -Xms10g -d64 HelloWorldApp

Error occurred during initialization of VM
Could not reserve enough space for object heap

Why it happens and how to remediate the issue?

Update. Output of ulimit -a:

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 10
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 25525
virtual memory          (kbytes, -v) unlimited
9
  • Is your machine 32-bit or 64-bit?
    – cuonglm
    Commented Aug 20, 2014 at 12:11
  • 64-bit powerful server machine Commented Aug 20, 2014 at 12:12
  • 1
    Can you post result of ulimit -a?
    – cuonglm
    Commented Aug 20, 2014 at 12:16
  • @Gnouc Done * * * Commented Aug 20, 2014 at 12:18
  • 1
    Still would want to see output from java -version -d64, please.
    – peterh
    Commented Aug 21, 2014 at 9:40

3 Answers 3

1

You can have available RAM but still run out of swap. I believe this could be what you are experiencing. Investigate with swap -s.

As a second idea the problem may be due to the fact that there isn't enough contiguous memory available although it would seem fairly odd if the OS cannot find 10 GB contiguous free memory when there seems to >100 GB free.

3
  • It's definetelly could be the case, because Java allows to start process with heap no larger than awailable swap space. After start, swap space is reduced to that exact amount (heap size). It's only a question why system uses swap instead of RAM?! Commented Aug 21, 2014 at 10:14
  • If you cannot grow swap on disk could you swap over a ramdisk?
    – LatinSuD
    Commented Aug 21, 2014 at 10:27
  • 3
    It doesn't use Swap space instead of RAM, but Solaris doesn't overcommit memory so you need to have enough swap to account for the memory reservations you expect. The JVM is in fact doing a memory reservation when it is trying to grab that 10 GB. Increase your swap and see if it helps.
    – peterh
    Commented Aug 21, 2014 at 10:47
1

Your swap area is highly undersized. A large part of the RAM reported to be free is in fact currently unusable because it serves as a backing store to other programs memory reservations. Just add some swap, it can be a simple file, and you'll be able to launch your JVM.

0

Try with the following instead:

java -Xms512m -Xmx512m -d64 HelloWorldApp

or

java -Xms1024m -Xmx1024m -d64 HelloWorldApp

May also be because it is too high.

6
  • Works with up to 4g. Commented Aug 20, 2014 at 13:26
  • You absolutely need +4g? Commented Aug 20, 2014 at 13:28
  • Yes I do. But it's not about my needs, it's about why am I not available to use RAM which should, by my logic, available? Commented Aug 20, 2014 at 13:48
  • Ok. What is your output of free -m? Also from when you are running the java program with 4g. Commented Aug 20, 2014 at 13:52
  • free tool is, unfortunatelly, unavailable on Solaris. Commented Aug 20, 2014 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .