本文介绍了老一代空间在JVM中的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就我所知,对于旧一代JVM中的空间,它可以用于两个目的,用于对象的


  1. 从年轻一代推广到老一代?

  2. 用于特殊用例中的新对象分配)

我的问题是,


  1. 是否有任何其他用例会在旧一代中使用空间?

  2. 我认为有一个内存拷贝涉及从年轻一代复制对象对老一代来说,它是一个深层复制还是一个浅层复制?

预先感谢,
Lin

解决方案

让我回答2.它绝对不是一个深层副本:GC将对象当作disti nct内存块和深度复制实际上只意味着复制连接到对象图中的许多不同对象。此外,通过想象移动而不是副本,您可以更好地服务。复制实际上只是一个实现细节,所需的效果正在重新定位。

As far as I know, for space in old generation of JVM, it could be utilized for two purposes,

  1. used for objects promoted from young generation to old generation?
  2. used for new object allocation in special use cases (https://stackoverflow.com/questions/9053144/will-i-encounter-java-lang-outofmemoryerror-even-with-no-lack-of-memory)

My questions are,

  1. Are there any other use cases to which will utilize space in old generation?
  2. I think there is a memory copy involved to copy objects from young generation to old generation, is it a deep copy or a shallow copy?

thanks in advance,Lin

解决方案

Let me answer 2. It is definitely not a deep copy: the GC handles objects as distinct memory blocks and deep copying really only means copying many distinct objects that are connected into an object graph. Also, you'd be better served by imagining a move, not a copy; copying is in fact just an "implementation detail" and the desired effect is relocating.

这篇关于老一代空间在JVM中的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 01:38