on 12-02-2006 2:07 PM
Hi All,
I increased teh JVM Heap size thru command prompt
java -Xms512m -Xmx512m.
But i am not sure this applied or not to my JVM becaz after teh exceution of command it is just givean message usage and Help.
So can you plz guide me how to set the JVM Heap size correctly and any command is there to print the JVM heap Size which we set previously?
or else provide some sample code in java to print the JVM Heap Size.
Regds
Phanikumar
Hi Phani,
In Windows environment you need to set the Environment Variable.
Right Click on MyComputer -> Advanced -> Environment Variables
Add the following values:
Variable : JAVA_OPTS
Value : -Xms512m -Xmx512m
If you want to print Heap size value the in command prompt type
> echo %JAVA_OPTS%
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
I did the same by create an ENV variable and set the value like this.
Variable : JAVA_OPTS
Value : -Xms512m -Xmx512m
But when i tried to print the echo %JAVA_OPTS% it is showing the
-Xms512m -Xmx512m. Then how should we confirm whether it is
set to 512MB or not?
Is it possible to print only 512MB ?
Regds
phanikumar
If you want to show what memory is available to your application you can use the Runtime class methods.
Ie:
String getMemoryStats()
{
return "Free memory: "Runtime.getRuntime().freeMemory()/1000000" out Of "Runtime.getRuntime().totalMemory()/1000000" MB";
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.