内存缺失:年轻代的大小只包含一个幸存者空间

Missing memory: size of young generation includes only one survivor space(内存缺失:年轻代的大小只包含一个幸存者空间)

本文介绍了内存缺失:年轻代的大小只包含一个幸存者空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java 堆上,我预计年轻一代的大小将是eden空间两个幸存者空间(从空间到空间):

On the Java heap, I expected that the size of the young generation would be the sum of the sizes of the eden space and both of the survivor spaces (from space and to space):

[young gen size] = [eden space size] + [from space size] + [to space size]

但是,GC 日志(使用 XX:+PrintHeapAtGC)表明 young generation 的大小是 eden 空间大小的总和 并且只有幸存者空间之一:

However, GC logs (using XX:+PrintHeapAtGC) state that the size of the young generation is the sum of the sizes of the eden space and only one of the survivor spaces:

[young gen size] = [eden space size] + [from space size]

为什么年轻代的大小只包括一个幸存者空间的大小?

可能是因为只有一个幸存者空间可用?但是两个幸存者空间都存在,所以两个幸存者空间都应该为新一代的规模做出贡献?

Maybe because only one of the survivor spaces is available at any time? But both survivor spaces exist so both survivor spaces should contribute to the size of the new generation?

GC 日志:

{Heap before GC invocations=48 (full 17):
par new generation   total 943744K, used 891496K [0x000000073ae00000, 0x000000077ae00000, 0x000000077ae00000)
  eden space 838912K, 100% used [0x000000073ae00000, 0x000000076e140000, 0x000000076e140000)
  from space 104832K,  50% used [0x000000076e140000, 0x000000077149a040, 0x00000007747a0000)
  to   space 104832K,   0% used [0x00000007747a0000, 0x00000007747a0000, 0x000000077ae00000)

来自:

[young gen size] = [eden space size] + [from space size]
     943744K     =      838912K      +      104832K

推荐答案

在任何时候,幸存者空间之一总是为空,因此不能被视为可用.

At any time one of the survivor spaces is always empty, so it cannot be considered available.

这篇关于内存缺失:年轻代的大小只包含一个幸存者空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:内存缺失:年轻代的大小只包含一个幸存者空间