Java garbage Collection algorithm

Source: Internet
Author: User

1. Mark-Clear

Mark objects that need to be recycled

Uniformly reclaim all tagged objects after the tag is complete


Insufficient:

Inefficient, resulting in too much memory fragmentation


2. Copy algorithm

Divide the whole memory into two pieces

When a piece of memory ran out

Copy the surviving object to another piece

Clean up the memory you just used


Advantages: Simple to implement, efficient to run, no debris generation

Insufficient: Space costs are high, reducing memory by half


3. Marking-Sorting algorithm

Let all the surviving objects move toward one end

Clean up memory outside the boundary of the tuning port


4. Collection of Generations

Divide the Java heap into the new generation and the old age

New generation: Every garbage collection has a large number of objects dead, few objects surviving (method 2)

Old age: High object Survival (marker-finishing)




This article is from the "11801219" blog, please be sure to keep this source http://11811219.blog.51cto.com/11801219/1795266

Java garbage Collection algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.