-Xmn JVM parameters in java - Setting young generation size


In this core java tutorial we will learn What is -Xmn JVM parameters in java.

Contents of page >
  • What is -Xmn JVM parameter in java?
    • Examples of using -Xmn VM option in java >
  • Summary -


Before learning about -Xmn JVM parameter in java we must know about java heap memory structure.

JVM Heap memory (Hotspot heap structure)  in java consists of following elements>
  1. Young Generation
    • 1a) Eden,
    • 1b) S0 (Survivor space 0)
    • 1c) S1 (Survivor space 1)
  2. Old Generation (Tenured)
  3. Permanent Generation.


What is -Xmn JVM parameter in java?
-Xmn : -Xmn sets the size of young generation.
Examples of using -Xmn VM (JVM) option in java >
Example1 of using -Xmn VM (JVM) option in java >
java -Xmn512 MyJavaProgram
It will set the size of young generation of JVM heap to 512 bytes.

Example2 of using -Xmn VM (JVM) option in java >
java -Xmn512k MyJavaProgram
It will set the size of young generation of JVM heap to 512 kilobytes.

Example3 of using -Xmn VM (JVM) option in java >
java -Xmn512m MyJavaProgram
It will set the size of young generation of JVM heap to 512 megabytes.

Example4 of using -Xmn VM (JVM) option in java >
java -Xmn1g MyJavaProgram
It will set the size of young generation of JVM heap to 1 gigabyte.



Summary -

So in this core java tutorial we learned what is -Xmn JVM parameters in java. And how to use -Xmn VM parameter with examples.


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>


No comments:

Post a Comment