Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways in which the new generation of Java objects have entered the old age?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to talk to you about the ways in which the new generation of Java objects have entered the old age. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can gain something according to this article.

The big object goes directly into the older generation.

Large objects are Java objects that require a lot of contiguous memory space, such as long strings and arrays. Garbage collection is triggered in advance to get enough contiguous space to accommodate large objects when there is still a lot of space in memory.

The virtual machine provides a-XX:PretenureSizeThreshold parameter that allows objects larger than this setting to be allocated directly in the old days. The purpose of this is to avoid a large amount of memory replication between the Eden area and the two Survivor zones (the new generation uses the replication algorithm to collect memory).

Those who survive for a long time will enter the old generation.

The virtual machine defines an object age counter for each object. If the object is still alive after the first Minor GC created in Eden and can be accommodated by Suivivor, it will be moved to the Survivor space and the object age will be set to 1. Every time you experience Minor GC, your age will increase by 1 year, and when you reach a certain level (default 15 years old, you can set it through the parameter-XXMaxTenuringThreshold), you will be promoted to the older generation.

Dynamic object age determination

In order to better adapt to different program memory conditions, virtual machines do not rigidly require objects to reach the age of MaxTenuringThreshold in order to promote the old age. If the total size of all objects of the same age in the Survivor space is more than half of the Survivor space, objects older than or equal to that age can directly enter the old generation.

After reading the above, do you have any further understanding of the way the new generation of Java objects enters the old age? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report