Solved

Could not reserve enough space for object heap, Could not create the Java virtual machine on RHEL 5.10

Posted on 2014-04-03
16
3,290 Views
Last Modified: 2014-04-28
I am unable to reserve java heap memory more than 1582MB on RHEL 5.10, inspite of having 6gig free memory.

[root@ora-dev15-ebs ~]# cat /etc/issue
Oracle Linux Server release 5.10
Kernel \r on an \m

[root@ora-dev15-ebs ~]#uname -a
Linux ora-dev15-ebs 2.6.32-400.34.3.el5uek #1 SMP Thu Feb 13 15:00:42 PST 2014 i686 i686 i386 GNU/Linux

[root@ora-dev15-ebs ~]# free -mtl
             total       used       free     shared    buffers     cached
Mem:          8066       1660       6405          0        109        533
Low:           760        284        475
High:         7305       1375       5930
-/+ buffers/cache:       1017       7049
Swap:        10239          0      10239
Total:       18306       1660      16645
 
[root@ora-dev15-ebs ~]#  java -Xmx1582m -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) Server VM (build 20.7-b02, mixed mode)

[root@ora-dev15-ebs ~]#  java -Xmx1583m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.



[root@ora-dev15-ebs ~]# 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) 64496
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) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 64496
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
0
Comment
Question by:sudhirgoogle
  • 7
  • 4
  • 3
  • +2
16 Comments
 
LVL 34

Expert Comment

by:Seth Simmons
Comment Utility
you are running 32bit java on 32bit linux
there are limits on heap size
what if you set Xmx to 1G - does it still fail?
you may not be able to set the heap size that high on 32bit architecture
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
I have similar 32bit arch server on which i can set heap size upto 2.6Gig

[root@ora-dev14-ebs ~]# cat /etc/issue
Oracle Linux Server release 5.7
Kernel \r on an \m

[root@ora-dev14-ebs ~]# uname -a
Linux ora-dev14-ebs 2.6.18-274.el5PAE #1 SMP Mon Jul 25 13:45:56 EDT 2011 i686 i686 i386 GNU/Linux
[root@ora-dev14-ebs ~]#
[root@ora-dev14-ebs ~]# free -mtl
             total       used       free     shared    buffers     cached
Mem:          8114       3191       4922          0        282       1630
Low:           818        532        286
High:         7295       2659       4636
-/+ buffers/cache:       1279       6835
Swap:        10239          0      10239
Total:       18354       3191      15162
[root@ora-dev14-ebs ~]#

[root@ora-dev14-ebs ~]#  java -Xmx2600m -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) Server VM (build 20.7-b02, mixed mode)

[root@ora-dev14-ebs ~]#
[root@ora-dev14-ebs ~]#
[root@ora-dev14-ebs ~]#  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) 147456
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) 147456
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[root@ora-dev14-ebs ~]#
0
 
LVL 9

Accepted Solution

by:
sanjooz earned 500 total points
Comment Utility
The JVM will allocate contiguous virtual memory for heap, so how much you can allocate can depend on what else is going on with your memory. Address space fragmentation and usage by the OS will influence how much you can allocate.
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
is there any other alternate method to allocate contiguous virtual memory for heap? somehow i must allocate memory around 2gig. Please help.
0
 
LVL 26

Expert Comment

by:dpearson
Comment Utility
If it is a problem with fragmentation of the virtual address space then your best bet would be a simple reboot and then attempting to launch the Java process ahead of other services on the machine.

But if you have 6GB of addressable RAM, then I think you must be running a 64-bit OS (it's not very clear to me from what you posted - I think you should run "uname -m" to clarify this).  If you are on a 64-bit OS, then is there any reason not to be using 64-bit Java?  It will handle larger memory sizes much better than 32-bit Java.

Doug
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
here is the output for uname -m

[root@ora-dev15-ebs ~]#uname -m
i686
[root@ora-dev15-ebs ~]#

Rebooting the server needs approval, is there any other way to allocate contiguous space without a reboot.
0
 
LVL 9

Expert Comment

by:sanjooz
Comment Utility
Just because the computer has 6 GB memory doesn't mean it is 64 bit. The 32bit restrictions were with the original 32 bit hardware, with PAE a 32 bit RHEL system can use 16 GB of ram. From the uname -a above this is what the OP has.

See this: http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&dlc=en&docname=c02456298



Can you post output of : cat /proc/meminfo
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
here is the meminfo output

[root@ora-dev15-ebs ~]# cat /proc/meminfo
MemTotal:        8259888 kB
MemFree:         6278372 kB
Buffers:          127876 kB
Cached:           684912 kB
SwapCached:            0 kB
Active:          1280148 kB
Inactive:         485256 kB
Active(anon):     958964 kB
Inactive(anon):      644 kB
Active(file):     321184 kB
Inactive(file):   484612 kB
Unevictable:        8096 kB
Mlocked:            8096 kB
HighTotal:       7481288 kB
HighFree:        5821056 kB
LowTotal:         778600 kB
LowFree:          457316 kB
SwapTotal:      10485752 kB
SwapFree:       10485752 kB
Dirty:               136 kB
Writeback:             0 kB
AnonPages:        960704 kB
Mapped:            52180 kB
Shmem:               132 kB
Slab:             169668 kB
SReclaimable:     144688 kB
SUnreclaim:        24980 kB
KernelStack:        5776 kB
PageTables:         9112 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    14615696 kB
Committed_AS:    1782504 kB
VmallocTotal:     122880 kB
VmallocUsed:        6712 kB
VmallocChunk:      99056 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       10232 kB
DirectMap2M:      897024 kB
[root@ora-dev15-ebs ~]#
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:sanjooz
Comment Utility
Hmmm, you have plenty of swap left, Lets try this:

-XX:MaxPermSize=512m -Xms1583m -Xmx1583m
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
no luck :(

java -XX:MaxPermSize=512m -Xms1583m -Xmx1583m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
0
 
LVL 9

Expert Comment

by:sanjooz
Comment Utility
Okay I am running out of ideas, but lets try this:

Run following three commands for me and post the output.

1 : cat /proc/user_beancounters
2 : java -XX:MaxPermSize=512m -Xms1583m -Xmx1583m -version
3 : cat /proc/user_beancounters
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
here is the output

[root@ora-dev15-ebs ~]# cat /proc/user_beancounters
cat: /proc/user_beancounters: No such file or directory
[root@ora-dev15-ebs ~]# java -XX:MaxPermSize=512m -Xms1583m -Xmx1583m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
[root@ora-dev15-ebs ~]# cat /proc/user_beancounters
cat: /proc/user_beancounters: No such file or directory
[root@ora-dev15-ebs ~]#
0
 
LVL 61

Expert Comment

by:gheist
Comment Utility
You can run java-1.x.0-openjdk up to ~2.8GB heap
Or jrockit (support contract needed) to 4095M heap
Generic oracle java is no good for 32bit systems
0
 
LVL 61

Expert Comment

by:gheist
Comment Utility
kernel -Xms=2700M
kernel-PAE 2700M
kernel-uek 2600M

java = 1.7.0.51-2.4.4.2.0.1_el5_10
kernel-uek = 2.6.39-300.26.1
orhers = 2.6.18-371.4.1.el5
0
 
LVL 1

Author Comment

by:sudhirgoogle
Comment Utility
Thanks for your response. But as i mention in the beginning the same generic oracle java working absolutely fine with 2gig heap memory on another 32bit server.
0
 
LVL 61

Expert Comment

by:gheist
Comment Utility
I'd say upgrade the UEK kernel or go with "latest" RedHat-compatible
As you see I had no problems getting the heap you need.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now