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 is the concept of Java tag removal algorithm

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article focuses on "what is the concept of Java tag removal algorithm", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "what is the concept of Java tag removal algorithm"?

Preface

Tag removal algorithm (Mark-Sweep) is a very basic and common garbage collection algorithm, which was proposed and successfully invented by J.McCarthy and others in 1960 and applied to Lisp language.

Involved in concept

Let's take a look at mutator and collector. These two nouns often appear in garbage collection algorithms.

Collector refers to the garbage collector.

Mutator refers to parts other than the garbage collector, such as our application itself.

The responsibilities of mutator are generally NEW (allocating memory), READ (reading content from memory), and WRITE (writing content to memory), while collector is to reclaim memory that is not in use for mutator to use for NEW operations.

Algorithm principle

The label removal algorithm divides garbage collection into two stages, the marking stage and the cleaning stage. In the marking phase, collector traverses from the mutator root object and marks all the objects that can be accessed from the mutator root object, usually

In the object's header, record it as a reachable object. In the cleanup phase, collector linearly traverses the heap memory (heap memory) from beginning to end. If an object is not marked as reachable, read the object's header

Information, and recycle it. One possible implementation is to first mark all reachable objects starting from the root node through the root node in the marking phase. Therefore, an object that is not marked is a garbage object that is not referenced. All unmarked objects are then cleared during the cleanup phase.

There are problems

The biggest problem with the tag removal algorithm is that there are a large number of space debris, because the recovered space is discontinuous. In the process of heap space allocation of objects, especially for large objects, the efficiency of discontinuous memory space is lower than that of continuous space.

At this point, I believe you have a deeper understanding of "what is the concept of Java tag removal algorithm?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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