Common JVM configuration parameters

-XX: + PrintGC every time the printing-related trigger GC logs

-XX: + PrintGCDetails GC every time the trigger greater detail relevant log

-XX: + UseSerialGC Serial recovered

 

-Xms heap initial value (to be set and -Xmx as large, otherwise it will frequently GC)

-Xmx heap maximum available

-Xmn new generation heap maximum available

-XX: SurvivorRatio (survival area ratio) refers to the new generation of eden: the proportion of form / to area (from the same large space and to space) default eden to be bigger, because the object you want to be first on the newly created eden region, the default is roughly 8: 1: 1, if a large item, the new generation of more objects, there is provided 2: 1: 1, according to the actual situation

-XX: NewRatio (New Generation: old's) general default ratio of 1: 2

 

example:

public  class App {
     public  static  void main (String [] args) { 

        // the Java virtual machine (the process) can structure the biggest memory from the operating system where dug 
        System.out.println ( "java virtual machine (the process) from the operating system configuration can be dug where the maximum memory "+ Runtime.getRuntime () maxMemory () / 1024/1024 +." M " );
         // the Java virtual machine dug up but no access memory 
        System.out .println ( "java virtual machine dug up but no access memory" + Runtime.getRuntime () freeMemory () / 1024/1024 + "M." );
         // the Java virtual machine has now been dug up from the operating system there memory size, that is java virtual machine at the time this process takes all memory 
        System.out.println ( "java virtual machine has now been dug up from the operating system where memory size, that is java virtual machine at the time occupied by this process All memory " 
                . Runtime.getRuntime + () totalMemory The () / 1024/1024 +" M " );

    }
}

java virtual machine (the process) can be configured from the maximum memory the operating system where dug 7257M
java virtual machine dug up but no access memory 485m
java virtual machine has now been dug up from the operating system where memory size, that is, java virtual machine at the time this process takes all the memory 491M

 

 

JVM configuration: -Xmx20m -Xms5m heap is the maximum available 20M, 5M initial value of the stack

java virtual machine (the process) can be configured from the operating system where dug largest memory 18M 
java virtual machine dug up but no access memory 4M 
java virtual machine has now been dug up from the operating system where memory size, that is, All memory 5M java virtual machine at the time occupied by this process can be used to initialize the value stack // 5M

When I applied to the heap inside a Byte b [] = new Byte [3 * 1024 * 1024] when the array:

java virtual machine (the process) can be configured from the operating system where dug largest memory 18M 
java virtual machine dug up but no access memory 2M 
java virtual machine has now been dug up from the operating system where memory size, that is, All memory 15M java virtual machine at the time this process will certainly be occupied by more than 5 + // 3

 

New Generation ratio JVM configuration parameters: -Xms20m -Xmx20m -Xmn1m -XX: SurvivorRatio = 2 -XX: + PrintGCDetails -XX: + UseSerialGC

[GC (Allocation Failure) [DefNew: 505K-> 255K (768K), .0013863 secs] 505K-> 430K (20224K), .0014558 secs] [Times: the User SYS = 0.00 = 0.00, = 0.00 secs Real]
the Java Virtual Machine ( this process) can be configured from the operating system where dug biggest memory // 19M  -Xmx20m heap maximum available
java virtual machine dug up but no access memory 19M
java virtual machine has now been dug up from the operating system where memory size, that is java virtual machine at the time this process takes all memory // 19M -Xms20m initial value of the available heap
heap
DEF new new Generation Total 768K , Used 514K [0x00000000fec00000, 0x00000000fed00000, 0x00000000fed00000) // Xmn1m new generation heap available
eden space 512K , 50% Used [0x00000000fec00000, 0x00000000fec40bd0, 0x00000000fec80000) // -XX: Eden SurvivorRatio = 2: form: to = 2:. 1:. 1
from Space 256K , 99% Used [0x00000000fecc0000, 0x00000000fecffff8, 0x00000000fed00000)
to space 256K, 0% used [0x00000000fec80000, 0x00000000fec80000, 0x00000000fecc0000)
tenured generation total 19456K, used 174K [0x00000000fed00000, 0x0000000100000000, 0x0000000100000000)
the space 19456K, 0% used [0x00000000fed00000, 0x00000000fed2b9d0, 0x00000000fed2ba00, 0x0000000100000000)
Metaspace used 2577K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 282K, capacity 386K, committed 512K, reserved 1048576K

-XX: NewRatio = 2 new generation of memory: the old year = 1: 2

 

Guess you like

Origin www.cnblogs.com/pickKnow/p/11121001.html