new collection java_Java Garbage Collection - New Threshold

The young generation is divided into three regions: an Eden space and two survivor spaces. Most objects (very large objects will be the exception) are allocated in Eden space using a simple (and fast) pointer bumping method. When the pointer reaches the end of the Eden space, a minor GC needs to occur. Rather than promoting all objects into the old gen straight away, they are allowed to sit in a survivor space for a period of time to give them longer to become garbage and reduce the load on the old gen collection.

There are two survivor spaces; one is the 'from' space (currently containing objects) and one is the 'to' space (effectively empty). Live data from Eden is copied to the 'to' space as well as any objects that are still live and have not reached the new threshold in the 'from' space. The roles of the two survivor spaces are then reversed ('to' becomes 'from', 'from' becomes 'to') ready for the next minor GC.

Objects in the survivor space that have reached the new (often called tenuring) threshold are promoted to the old generation.

Clearly, if your application allocates objects at a rate faster than the survivor spaces can handle the GC will promote objects more quickly. The parameter that affects this is the MaxTenuringThreshold, which is a maximum, not a definite value.

You can tune the size of the regions with a variety of parameters. Read this for more detail:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值