JDK8 gc时NewRatio等默认比例_newratio默认值_Zebul博的博客-程序员秘密

转自:https://blog.csdn.net/liuchaoxuan/article/details/80958128

JDK8
默认的,新生代 ( Young ) 与老年代 ( Old ) 的比例的值为 1:2 ( 该值可以通过参数 –XX:NewRatio 来指定 ),即:新生代 ( Young ) = 1/3 的堆空间大小。

老年代 ( Old ) = 2/3 的堆空间大小。其中,新生代 ( Young ) 被细分为 Eden 和 两个 Survivor 区域,这两个 Survivor 区域分别被命名为 from 和 to,以示区分。

默认的,Edem : from : to = 8 : 1 : 1 ( 可以通过参数 –XX:SurvivorRatio 来设定 ),即: Eden = 8/10 的新生代空间大小,from = to = 1/10 的新生代空间大小。

‍JVM 每次只会使用 Eden 和其中的一块 Survivor 区域来为对象服务,所以无论什么时候,总是有一块 Survivor 区域是空闲着的。

因此,新生代实际可用的内存空间为 9/10 ( 即90% )的新生代空间。


Java 中的堆是 JVM 所管理的最大的一块内存空间,主要用于存放各种类的实例对象。

在 Java 中,堆被划分成两个不同的区域:新生代 ( Young )、老年代 ( Old )。新生代 ( Young ) 又被划分为三个区域:Eden、From Survivor、To Survivor。

这样划分的目的是为了使 JVM 能够更好的管理堆内存中的对象,包括内存的分配以及回收。

堆的内存模型大致为:

JDK8中的默认参数:(windows平台)

见链接:http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABHDABI

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

参数的默认值:

ratio(比,比率;比例;系数)

-XX:NewRatio
-XX:NewRatio=ratio

Sets the ratio between young and old generation sizes. By default, this option is set to 2.The following example shows how to set the young/old ratio to 1:

-XX:NewRatio=1

-XX:SurvivorRatio
-XX:SurvivorRatio=ratio

Sets the ratio between eden space size and survivor space size. By default, this option is set to 8. The following example shows how to set the eden/survivor space ratio to 4:

-XX:SurvivorRatio=4

-Xmssize
Sets the initial size (in bytes) of the heap. This value must be a multiple of 1024 and greater than 1 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes.

The following examples show how to set the size of allocated memory to 6 MB using various units:

-Xms6291456

-Xms6144k

-Xms6m

If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation. The initial size of the heap for the young generation can be set using the -Xmn option or the -XX:NewSize option.

-Xmxsize
Specifies the maximum size (in bytes) of the memory allocation pool in bytes. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration. For server deployments, -Xms and -Xmx are often set to the same value. For more information, see Garbage Collector Ergonomics at http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html

The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:

-Xmx83886080

-Xmx81920k

-Xmx80m

The -Xmx option is equivalent to -XX:MaxHeapSize.

-XX:MaxHeapSize=size
Sets the maximum size (in byes) of the memory allocation pool. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration. For server deployments, -XX:InitialHeapSize and -XX:MaxHeapSize are often set to the same value. For more information, see Garbage Collector Ergonomics at http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html

The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:

-XX:MaxHeapSize=83886080

-XX:MaxHeapSize=81920k

-XX:MaxHeapSize=80m

The -XX:MaxHeapSize option is equivalent to -Xmx.

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u012501054/article/details/97814736

智能推荐

Hadoop中的ssh无秘钥登录配置_Rocky000000的博客-程序员秘密

ssh无秘钥登录配置对于需要远程管理其它机器,一般使用远程桌面或者telnet。linux一般只能是telnet。但是telnet的缺点是通信不加密,存在不安全因素,只适合内网访问。为解决这个问题,推出了通信加密通信协议,即SSH(Secure Shell)。使用非对称加密方式,传输内容使用rsa或者dsa加密,可以避免网络窃听。hadoop的进程之间同信使用ssh方式,需要每次都要输入密码。...

Java编年史_ThePromonkeyOf_HeLuo的博客-程序员秘密

Java在2015年再次被评为年度编程语言,王者再次归来。现总结一下Java的发展历史。Java20年95年前,Java前世 1991 年 Sun 公司 James Gosling 领导的的 Ork 项目。1995年Java诞生Sun 公司正式起名为 Java,并提出“Write once, Run anywhere”的口号。 1996年  Java版本:JDK 1.0  发布时间:1996年1

实验室管理系统(LIMS)涵盖的三层结构及应用_lims系统原型图_实验室信息化系统的博客-程序员秘密

从结构上看,实验室管理系统(LIMS)包括三个主要的层:1)应用层:亦称为技术层,用于LIMS系统与操作系统、网络及其它软件工具之间的交互;2)交互层:亦称为商业规则层,决定LIMS系统对不同情形的响应,例如需要在出报告之前进行最终产品的校核和批准等;3)数据层:用于信息的保存,例如样品测定结果。LIMS系统同其它领域的管理信息系统一样,伴随着计算机硬件、软件和网络等技术的发展而不断推陈出...

glibc编译debug版本_jichunlai的博客-程序员秘密

下载glibc http://ftp.gnu.org/gnu/glibc/you must configure in a separate build directory我把glibc安装在/usr/local/glibc2121目录下源代码放在/opt/glibc-2.12.1目录下cd  /usr/local/glibc2121/usr/

计算机组成原理汇编语言设计实验,《计算机组成原理汇编语言程序设计》实验指导书.doc..._愷629的博客-程序员秘密

《计算机组成原理汇编语言程序设计》实验指导书,汇编语言实验指导书,微机原理与汇编语言,微机原理及汇编语言,汇编转c语言原理,汇编语言原理,汇编语言和编译原理,汇编语言编译原理,计算机原理与汇编语言,计算机组成原理与汇编《计算机组成原理与汇编语言程序设计实验计算机组成原理与汇编语言程序设计实验汇编语言是信息与计算科学专业的一门专业课,对开发高级应用程序有重大意义,学习汇编程序有利于理解计算机系统中软...

随便推点

NOIP中的数学--第8课 容斥原理(一)_信奥教练Andy的博客-程序员秘密

小学数学知识–容斥原理容斥原理的题目都可以借助韦恩图这一工具来解决,并且非常快速与准确,一、关于两个集合的容斥原理集合 A 与B 的并集的元素个数,等于集合 A 的元素个数与集合B 的元素个数的和,减去集合A 与 B 的交的元素个数,即:|A∪B|=|A|+|B|-|A∩B|。二、关于三个集合的容斥原理三个圆A、B、C 分别表示具有三种不同性质的集合,并如图用M1、M2、M3、…、M7 表示由三个圆形成的内部互不重叠的部分所含元素的个数,可见:|A∪B∪C|=M1+M2+…+M7=(M1+M4

【linux】英文显示乱码解决_weixin_34234823的博客-程序员秘密

在linux环境中中文显示正常,而英文却显示乱码用echo $LANG显示编码为 zh_CN.GB18030 解决方法:输入export LC_ALL=POSIX即可

redis mem_fragmentation_ratio 过大_gtfaww的博客-程序员秘密

最近有个业务bug,导致redis存储了很多没用的key,删除后发现mem_fragmentation_ratio过大:127.0.0.1:6379> info memory# Memoryused_memory:104430120used_memory_human:99.59Mused_memory_rss:2633490432used_memory_peak:27098

Hypertable 简介 (一个 C++ 的Bigtable开源实现) 【很好的入门的例子】_ghlfllz的博客-程序员秘密

Hypertable 简介(Hypertable一个 C++ 的Bigtable开源实现) By云深作者:Adam/Schubert/SeymourZ  2008年8月转载请注明出处1           Introduction    随着互联网技术的发

百度换肤JavaScript功能_百度换皮肤代码js_「已注销」的博客-程序员秘密

百度换肤JavaScript功能CSS-code: <style type="text/css"> *{ margin: 0; padding: 0; list-style: none; } a{ color: red; ...

RabbitMQ笔记-使用rabbitmq-c让生产者发送数据_IT1995的博客-程序员秘密

目录环境下载地址过程环境RabbitMQ和Erlang的版本如下:rabbitmq-c的版本下载地址RabbitMQ下载地址:https://www.rabbitmq.com/download.html这里注意RabbitMQ 3.6.5的对应的Erlang的版本注意是19.X,不然web管控台插件会安装不上rabb...

推荐文章

热门文章

相关标签