本文介绍了G1 GC是否具有最大区域大小或区域最大量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我研究G1 GC时,我发现这篇文章:。在那篇文章中,有如下所示的内容:这是否意味着G1 GC可以处理的java堆内存的最大大小是2048 * 32M,如果大小超过它,会发生什么事情?
解决方案
From :
//最小区域大小;我们不会低于这个水平。
//我们可能会在将来减少这个值,以便更有效地处理小
//堆。
static const size_t MIN_REGION_SIZE = 1024 * 1024;
//最大区域大小;我们不会比这更高。有一个很好的
//有一个上限的理由。我们不希望区域获得太多的
//大,否则清理的效率会降低,因为
//在
//标记之后找到完全空的区域的机会会减少。
static const size_t MAX_REGION_SIZE = 32 * 1024 * 1024;
//自动区域大小计算将尝试在堆中的许多区域(基于最小堆大小)周围存在这个
。
static const size_t TARGET_REGION_NUMBER = 2048;
-
MIN_REGION_SIZE
(1MB)和MAX_REGION_SIZE
(32MB)是硬性限制;
TARGET_REGION_NUMBER
只是用于计算默认区域大小的提示,如果它没有在JVM选项中指定的话。实际数量可能超过此值。
when i studied G1 GC, I found this article: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html. In that article, there is something says as follow:
Does that mean the max size of java heap memory that G1 GC can deal with is 2048 * 32M, and if the size exceeds it, what will happen?
解决方案
From HotSpot JVM sources:
// Minimum region size; we won't go lower than that.
// We might want to decrease this in the future, to deal with small
// heaps a bit more efficiently.
static const size_t MIN_REGION_SIZE = 1024 * 1024;
// Maximum region size; we don't go higher than that. There's a good
// reason for having an upper bound. We don't want regions to get too
// large, otherwise cleanup's effectiveness would decrease as there
// will be fewer opportunities to find totally empty regions after
// marking.
static const size_t MAX_REGION_SIZE = 32 * 1024 * 1024;
// The automatic region size calculation will try to have around this
// many regions in the heap (based on the min heap size).
static const size_t TARGET_REGION_NUMBER = 2048;
MIN_REGION_SIZE
(1MB) andMAX_REGION_SIZE
(32MB) are hard limits;TARGET_REGION_NUMBER
is just a hint that is used to calculate default region size if it is not specified among JVM options. The actual number may exceed this value.
这篇关于G1 GC是否具有最大区域大小或区域最大量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!