How to change the HEAP memory in the middle of computation

P

Paul K.

Hi! I ant to know if there is a way to reallocate the RAM memory for a
java application that is already running, Iknow that in order to set it
initially is like:


java -ms32m -mx128m MyClassName

but what if in the middle of the execution i need to get more memory
lets say up to 1G?

regards

paul.
 
M

mearvk

Paul said:
Hi! I ant to know if there is a way to reallocate the RAM memory for a
java application that is already running, Iknow that in order to set it
initially is like:


java -ms32m -mx128m MyClassName

but what if in the middle of the execution i need to get more memory
lets say up to 1G?

regards

paul.

There are 3 flags you should use. I believe these flags will solve your
problem:

-Xmn 256M -Xms 512M -Xmx 1024M

-Xmn is your minimum.
-Xms is your initial.
-Xmx is your maximum.

This allows the JVM a lot of room and should address your concerns.

Mearvk
 
D

Daniel Pitts

Paul said:
Hi! I ant to know if there is a way to reallocate the RAM memory for a
java application that is already running, Iknow that in order to set it
initially is like:


java -ms32m -mx128m MyClassName

but what if in the middle of the execution i need to get more memory
lets say up to 1G?

regards

paul.

The JVM will allocated an initial amount... When there isn't enough
heap at any given time, it will increase the heap size up to the stated
maximum. You should set the maximum to 1024m if you want to allow it
to go up to 1G.

HTH
- Daniel.
 
T

Timothy Bendfelt

There are 3 flags you should use. I believe these flags will solve your
problem:

-Xmn 256M -Xms 512M -Xmx 1024M

-Xmn is your minimum.
-Xms is your initial.
-Xmx is your maximum.

-Xmn specifies the young generation size. It informs the ratio hotspot
uses between old and new generation spaces. It should never be set to
larger that 1/2 the total heap size (unless the parallel collector is in
use -XX:+UseParallelGC)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top