How to reduce the use of virtual memory JVM?

I have a Java program to run on Solaris 10 X86 with 2 GB physical memory and 2 GB change.

The program works fine on a 64-bit version of Linux, it consumes only about 450 MB of memory.

However, when it launches on Solaris, it always raises an OutOfMemoryError, and I noticed that just before the error occurred, he tried to use> 4 GB of virtual memory, which is definitely not possible on a 32-bit system.

So why is the JVM trying to use this large virtual memory? Is there any way to tell the JVM not to use this large virtual memory?

Thanks.

Edit:

Thanks everyone! Here is the complete error message:

# # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate # Possible reasons: # The system is out of physical RAM or swap space # In 32 bit mode, the process size limit was hit # Possible solutions: # Reduce memory load on the system # Increase physical memory or swap space # Check if swap backing store is full # Use 64 bit Java on a 64 bit OS # Decrease Java heap size (-Xmx/-Xms) # Decrease number of Java threads # Decrease Java thread stack sizes (-Xss) # Set larger code cache with -XX:ReservedCodeCacheSize= # This output file may be truncated or incomplete. # # Out of Memory Error (allocation.cpp:211), pid=1052, tid=16 # # JRE version: 6.0_26-b03 # Java VM: Java HotSpot(TM) Server VM (20.1-b02 mixed mode solaris-x86 ) --------------- THREAD --------------- Current thread (0x081a3400): JavaThread "C2 CompilerThread1" daemon 
+6
source share
2 answers

Perhaps you are passing JVM parameters that use this large memory.

Depending on the exact error, is there a problem with cumulus space or a problem with space in space? - passing parameters to jvm, such as -Xms512m and -Xmx512m, or -XX: PermSize = 128m and -XX: MaxPermSize = 128m, can solve the problem on your system.

+3
source

Try setting the jvm param -Xmx1g parameter to limit the use to no more than 1 gigabyte.

+1
source

Source: https://habr.com/ru/post/923223/


All Articles