JVM memory area size parameter

JVM memory including regional

Heap (heap)
  New Generation (New Generation)
  Eden Eden
  Survivor the From
  Survivor the To
  Old Generation (years old)
method area
  Permanent Generation (permanent generation)
  Stack (stack area)
  Metaspace (dimensional space)
  Direct ByteBuffer (outside heap memory)
by JVM start parameters to configure more memory space
  heap (heap) memory size
  -Xms512m initial JVM heap memory is provided 512M
  -Xmx1g set maximum JVM heap memory is available. 1G

New Generation (new generation) memory size
  -Xmn256m new generation memory provided JVM size (-Xmn NewSize is set consistent with MaxNewSize .256m), with the following two parameters
  -XX: 256M NewSize =
  -XX: MaxNewSize = 256M

Size set by the new generation to the new generation of memory's old and ratios
  -XX: NewRatio = 3
  set the new generation (including Eden and two Survivor areas) the ratio of old age. Is set to 3, then the new generation and the old share's ratio of 1: 3, accounting for 1/4 of the entire stack of new generation

Survivor memory size
  -XX: SurvivorRatio = 8
  is set to 8, the ratio of the two regions with a Survivor Eden zone is 2: 8, a new generation in the total area Survivor 1/10

Eden memory size
Cenozoic minus * Survivor memory size is the size of Eden 2

Old Generation (elderly) Set the memory size
  heap memory minus the new generation of memory
  parameters such as exemplified above provided the following:
  the initial year old memory is: 512M-256M = 256M
  old's maximum memory: 1G-256M = 768M

Stack (stack) memory size
  -Xss1m
  each thread will have a stack. At the same physical memory, reducing this value can generate more threads. If this value is too small will affect the depth of the method call

Permanent Generation (Generation persistent) memory size
  method of memory allocation area (JDK8 previous version, since no persistent JDK8 generations, used MetaSpace)
  -XX: 128M provided PermSize = initial permanent generation memory size 128M
  -XX: MaxPermSize = 512M set maximum permanent generation memory size 512M


Direct ByteBuffer(直接内存)内存大小设置
  -XX:MaxDirectMemorySize
  当Direct ByteBuffer分配的堆外内存到达指定大小后,即触发Full GC。该值是有上限的,默认是64M,最大为sun.misc.VM.maxDirectMemory()。
  在程序中可以获得-XX:MaxDirectMemorySize的设置的值

设置新生代代对象进入老年代的年龄
  -XX:MaxTenuringThreshold=15

  设置垃圾最大年龄。如果设置为0的话,则新生代对象不经过Survivor区,直接进入老年代。

  对于老年代比较多的应用,可以提高效率。如果将此值设置为一个较大值,则新生代对象会在Survivor区进行多次复制,这样可以增加对象在新生代的存活时间,增加在新生代即被回收的概论
  最大值为15岁,因为对象头中用了4位进行存储垃圾年龄 【1111(二进制)=15(十进制)】

不常用的参数
  -XX:MaxHeapFreeRatio=70
  GC后java堆中空闲量占的最大比例,大于该值,则堆内存会减少

  -XX:MinHeapFreeRatio=40
  GC后java堆中空闲量占的最小比例,小于该值,则堆内存会增加

  -XX:PretenureSizeThreshold=1024
  (单位字节)对象大小大于1024字节的直接在老年代分配对象

  -XX:TLABWasteTargetPercent =1
  TLAB占eden区的百分比 默认1%

 

Guess you like

Origin www.cnblogs.com/Zfc-Cjk/p/11587827.html