Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I increase the JVM memory? [duplicate]

Tags:

java

jvm

HI, I like to know can I increase the memory of the JVM depending on my application.If yes how can I increase the JVM memory? And how can I know the size of JVM?

like image 822
giri Avatar asked Feb 19 '10 05:02

giri


People also ask

Can we increase JVM memory?

To increase the Application Server JVM heap sizeNavigate to the JVM options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.

How do I free up JVM memory?

When a Java program needs memory, it requests this memory from the JVM. If there is no memory left, then the JVM will attempt to free some memory by using the garbage collector. The garbage collector will try to release memory that is no longer required to run the program back to the JVM.

What happens if JVM memory is full?

Java objects reside in an area called the heap. The heap is created when the JVM starts up and may increase or decrease in size while the application runs. When the heap becomes full, garbage is collected. During the garbage collection objects that are no longer used are cleared, thus making space for new objects.

How much memory should I allocate to JVM?

Therefore we recommended that physical memory availability for each JVM be 4096 MB;0.5 GB is for JVM allocation and 512 MB is for overhead. This simplified calculation means that a 64-bit system with 16 GB physical memory can run 3 JVMs.


1 Answers

When starting the JVM, two parameters can be adjusted to suit your memory needs :

-Xms<size> 

specifies the initial Java heap size and

-Xmx<size> 

the maximum Java heap size.

http://www.rgagnon.com/javadetails/java-0131.html

like image 196
hodgesmr Avatar answered Sep 21 '22 20:09

hodgesmr