You are here : Home / Core Java Tutorials / Series of JVM and Garbage Collection (GC) in java - Best explanations ever
In this core java tutorial we will learn What are -XX:PermSize and -XX:MaxPermSize JVM parameters in java, And differences between -XX:PermSize and -XX:MaxPermSize JVM parameters in java.
Contents of page >
- What is -XX:PermSize JVM parameter in java?
- Examples of using -XX:PermSize VM (JVM) option in java >
- What is -XX:MaxPermSize JVM parameter in java?
- Examples of using -XX:MaxPermSize VM option in java >
- What is the maximum perm gen size value you can set on your system, if you aren’t sure about the system configurations?
- What are differences between -XX:PermSize and -XX:MaxPermSize JVM parameters in java?
Before learning about -XX:PermSize and -XX:MaxPermSize JVM parameters in java we must know about java heap memory structure.
Earlier we read about JVM Heap memory (Hotspot heap structure) in java consists of following elements>
- Young Generation
- 1a) Eden,
- 1b) S0 (Survivor space 0)
- 1c) S1 (Survivor space 1)
- Old Generation (Tenured)
- Permanent Generation.
What is -XX:PermSize JVM parameter in java?
-XX:PermSize : It’s is initial value of Permanent Space which is allocated at startup of JVM.
Examples of using -XX:PermSize VM (JVM) option in java >
Example1 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=512 MyJavaProgram
It will set initial value of Permanent Space as 512 bytes to JVM.
Example2 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=512k MyJavaProgram
It will set initial value of Permanent Space as 512 kilobytes to JVM
Example3 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=512m MyJavaProgram
It will set initial value of Permanent Space as 512 megabytes to JVM
Example4 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=1g MyJavaProgram
It will set initial value of Permanent Space as 512 gigabyte to JVM
What is -XX:MaxPermSize JVM parameter in java?
-XX:MaxPermSize : It’s maximum value of Permanent Space that JVM can allot up to.
Examples of using -XX:MaxPermSize VM option in java >
Example1 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=512 MyJavaProgram
It will set maximum value of Permanent Space as 512 bytes to JVM.
Example2 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=512k MyJavaProgram
It will set maximum value of Permanent Space as 512 kilobytes to JVM
Example3 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=512m MyJavaProgram
It will set maximum value of Permanent Space as 512 megabytes to JVM
Example4 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=1g MyJavaProgram
It will set maximum value of Permanent Space as 1 gigabyte to JVM
What is the maximum perm gen size value you can set on your system, if you aren’t sure about the system configurations?
Try out for -XX:MaxPermSize=256m, if it works then try -XX:MaxPermSize=512m, if it works then try -XX:MaxPermSize=1024m and so on. Be cautious before going beyond 8g.
What are differences between -XX:PermSize and -XX:MaxPermSize JVM parameters in java?
-XX:PermSize JVM parameter
|
-XX:MaxPermSize JVM parameter
|
It’s is initial value of Permanent Space which is allocated at startup of JVM.
|
It’s maximum value of Permanent Space that JVM can allot up to.
|
Examples of using -XX:PermSize VM (JVM) option in java >
Example1 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=512m MyJavaProgram
It will set initial value of Permanent Space as 512 megabytes to JVM
Example2 of using -XX:PermSize VM (JVM) option in java >
java -XX:PermSize=1g MyJavaProgram
It will set initial value of Permanent Space as 512 gigabyte to JVM
|
Examples of using -XX:MaxPermSize VM option in java >
Example1 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=512m MyJavaProgram
It will set maximum value of Permanent Space as 512 megabytes to JVM
Example2 of using -XX:MaxPermSize VM (JVM) option in java >
java -XX:MaxPermSize=1g MyJavaProgram
It will set maximum value of Permanent Space as 1 gigabyte to JVM
|
Summary -
So in this core java tutorial we learned what are -XX:PermSize and -XX:MaxPermSize JVM parameters in java, And differences between -XX:PermSize and -XX:MaxPermSize JVM parameters in java.
Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.
RELATED LINKS>