Operating System - HP-UX
1845035 Members
2026 Online
110233 Solutions
New Discussion

java.lang.OutOfMemoryError

 
SOLVED
Go to solution
Ernesto Rincon
Frequent Advisor

java.lang.OutOfMemoryError

Hi:

I'm having some problems with Java (Java RTE/SDK 1.4)in HP-UX 11i:
$ ${JAVA_HOME}/bin/java -classpath $CLASSPATH:.:/TRAP/tushar MemoryTest 64
Mermory size is: 67108864
Successfully Captured memory
Hello World!

the above execution is successully for 64 MB

$ ${JAVA_HOME}/bin/java -classpath $CLASSPATH:.:/TRAP/tushar MemoryTest 75
Mermory size is: 78643200
Exception in thread "main" java.lang.OutOfMemoryError
at java.nio.Bits.reserveMemory(Bits.java:618)
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:95)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:285)
at MemoryTest.main(MemoryTest.java:10)

the above execution fails for 75 MB

We need to test the above memory program for 10 GB of memory.

I'm including kernel parameters.
The RAM memory of the server is 96 Gb
Swap space is 16 Gb
Any suggestions?

Thanks..
5 REPLIES 5
Jon M Zellhoefer
Valued Contributor
Solution

Re: java.lang.OutOfMemoryError

Check your kernel params for max. shared memory segment size for 32/64 bit depending on OS/Java versions. My guess is your values are too low.

For a 64 bit system:
maxssiz_64bit
maxtsiz_64bit
shmmax

If you want to exceed 10GB make sure the values are set to allow that. By default, they're relatively small.
A. Clay Stephenson
Acclaimed Contributor

Re: java.lang.OutOfMemoryError

Because you are not reaching maxdsiz yet, I suspect your problem is rather the size of the Java heap. You need to launch Java with a bigger Maximum heap (e.g. -Xmx256m [256MB]). However, your kernel is badly tuned (although this is not your immediate problem); your max_dbc_pct is left at the default 50% which means that you have a ridiculously large buffer cache. In systems with this much memory, it makes much more sense to set a static buffer cache by setting bufpages to a non-zero value. About 1.6GB or so would be extremely generous.
If it ain't broke, I can fix that.
Ernesto Rincon
Frequent Advisor

Re: java.lang.OutOfMemoryError


Thanks for your comments Jon and A. Clay, I'm not skillfully with Java, so, could you recommend the values for these kernel parameters, please?

Regards..
A. Clay Stephenson
Acclaimed Contributor

Re: java.lang.OutOfMemoryError

No need just yet because you aren't hitting them yet. This is almost certainly the Java heap. When you get that fixed then you might begin to hit kernel limits.

Set bufpages = 409600 to give you 1.6GB of buffer cache.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: java.lang.OutOfMemoryError

By the way, you might be hitting ulimit values. Execute ulimit -a to be sure; even so, I still betting you need to launch Java with a bigger heap.
If it ain't broke, I can fix that.