The following changes take effect with J2SE 5.0.
-
On server-class
machines running the server
VM
, the garbage collector (GC) has changed from the previous serial
collector (-XX:+UseSerialGC
) to a parallel collector (-XX:+UseParallelGC
).
You can override this default by using the
-XX:+UseSerialGC
command-line option to the java
command.
- On server-class
machines running either
VM
(client or server) with the parallel garbage collector (
-XX:+UseParallelGC
)
the initial heap size and maximum heap size have changed as follows.
- initial heap size:
-
Larger of 1/64th of the machine's physical memory on the machine or
some reasonable minimum. Before J2SE 5.0, the default initial heap size
was a reasonable minimum, which varies by platform. You can override
this default using the -Xms
command-line option.
- maximum heap size:
-
Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0, the
default maximum heap size was 64MB. You can override this default using
the -Xmx
command-line option.
Note:
The boundaries and fractions given for the heap size are correct
for J2SE 5.0. They are likely to be different in subsequent releases as computers
get more powerful.
-
The parallel garbage collector (UseParallelGC
) throws an out-of-memory
exception if an excessive amount of time is being spent collecting a small
amount of the heap. To avoid this exception, you can increase the size of
the heap. You can also set the parameters -XX:GCTimeLimit=
time-limit
and -XX:GCHeapFreeLimit=
space-limit
where:
- time-limit
:
- The upper limit on the amount of time spent in garbage collection in
percent of total time (default is 98).
- space-limit
:
- The lower limit on the amount of space freed during a garbage collection
in percent of the maximum heap (default is 2).
- The implementation of
-XX:+UseAdaptiveSizePolicy
used by default
with the -XX:+UseParallelGC
garbage collector has changed to
consider three goals:
-
- a desired maximum GC pause goal
- a desired application throughput goal
- minimum footprint
The implementation checks (in this order):
-
- If the GC pause time is greater than the pause time goal then reduce the
generations sizes to better attain the goal.
- If the pause time goal is being met then consider the application's throughput
goal. If the application's throughput goal is not being met, then increase
the sizes of the generations to better attain the goal.
- If both the pause time goal and the throughput goal are being met, then
the size of the generations are decreased to reduce footprint.
Flags
-XX:MaxGCPauseMillis=
nnn
- A hint to the virtual machine that pause times of nnn
milliseconds
or less are desired. The VM will adjust the java heap size and other GC-related
parameters in an attempt to keep GC-induced pauses shorter than nnn
milliseconds. Note that this may cause the VM to reduce overall throughput,
and in some cases the VM will not be able to meet the desired pause time
goal.
By default there is no pause time goal. There are definite limitations
on how well a pause time goal can be met. The pause time for a GC depends
on the amount of live data in the heap. The minor and major collections
depend in different ways on the amount of live data. This parameter should
be used with caution. A value that is too small will cause the system
to spend an excessive amount of time doing garbage collection.
-XX:GCTimeRatio=
nnn
- A hint to the virtual machine that it's desirable that not more than
1 / (1 + nnn) of the application execution time be spent in the collector.
For example -XX:GCTimeRatio=19
sets a goal of 5% of the
total time for GC and throughput goal of 95%. That is, the application
should get 19 times as much time as the collector.
By default the value is 99, meaning the application should get at least
99 times as much time as the collector. That is, the collector should
run for not more than 1% of the total time. This was selected as a good
choice for server applications. A value that is too high will cause the
size of the heap to grow to its maximum.
Suggested strategy
Do not choose a maximum value for the heap unless you know that the heap
is greater than the default maximum heap size. Choose a throughput goal
that is sufficient for your application.
In an ideal situation the heap will grow to a value (less than the maximum)
that will support the chosen throughput goal.
If the heap grows to its maximum, the throughput cannot be met within
that maximum. Set the maximum heap as large as you can, but no larger than
the size of physical memory on the platform, and execute the application
again. If the throughput goal can still not be met, then it is too high
for the available memory on the platform.
If the throughput goal can be met but there are pauses that are too long,
select a pause time goal. This will likely mean that your throughput goal
will not be met, so choose values that are an acceptable compromise for
the application.
分享到:
相关推荐
Activation KMS Garbage Collector v1.3.4
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector
【IBM Pattern Modeling and Analysis Tool for Java Garbage Collector】是一款针对Java虚拟机(JVM)垃圾收集器进行性能分析和建模的专业工具。该工具由IBM开发,主要用于帮助开发者和系统管理员深入理解Java应用...
系统级编程的课程实验,实现内存的的自动回收管理。 这里需要声明的是,资源不是来自本人,资源来自网络。本着造福广大学生的目的。但是本人实在太菜,不知道如何设置资源分数为0,所以就设置为1. ...
Z Garbage Collector(ZGC)是Oracle开发的一种可扩展的低延迟垃圾收集器,专为满足现代服务器的高性能计算需求而设计。ZGC支持TB级别的堆大小,且其最大垃圾收集(GC)暂停时间被严格控制在10毫秒以下,大大降低了...
很久之前就一直在学习JVM,但是一直也没有好好的总结,最近终于有了空闲,将之前学习的内容整理成了一个PPT。PPT也可以在这里下载: ... 也希望大神们可以批评指正。 ppt中主要包含下面几部分: ...
自JAVA后,自动垃圾回收技术一下子闯入了编程开发的主流视野。其后的.net同样添加了对自动垃圾回收技术的支持。 自动垃圾回收虽然会对性能造成一定的影响,但在大对对性能要求不是特别苛刻的场合下,使用自动垃圾...
IBM的java 内存回收分析工具,用于分析gc日志
CMU的垃圾回收实验(IN C) 1.这个实验由我主讲,我制作了PPT,包含三种思路, 2.并提供其中最重要也是最简单的扫描Stack Frame的源码。 3.此外,有整体思考的思维导图,供全局预览。
IBM Pattern Modelin and Analysis Tool for Java Garbage Collector IBM Weblogic Application Service(WAS)GC(垃圾回收)日志分析工具
系统级编程实验,利用C语言实现垃圾回收器,避免在malloc分配内存后忘记free,导致内存泄漏等一些严重后果
In this lab you will be writing a conservative mark-and-sweep garbage collector for C programs. Download the materials of this lab. malloc.c
Go 1.5 concurrent garbage collector pacingAustin Clements 3/10/2015golang.org/s/go15gcpacing Comment at https://groups.google.com/forum/#!topic/golangdev/YjoG9yJktg4Introduction Prior ...
我们正在以渐进的方式发起一系列关于垃圾收集的文章。我们的目标是突出理论概念和实际实施,为相关挑战提供清晰的说明。
native_stderr.log分析工具
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector(4.39)
Eclipse-plugins 插件,eclipse 各种插件 .jar 包,免费下载 eclipse202106 -plugins 各种插件 .jar 包,免费下载 如果下载不了,关注我,评论区联系我, Eclipse-plugins eclipse, plugins, eclipse202106, ...
Garbage-First is a server-style garbage collector, targeted for multi-processors with large memories, that meets a soft real-time goal with high probability, while achieving high throughput. Whole-...