Java garbage collection mechanism

Source: Internet
Author: User

What is a GC? Why do we have a GC
A: GC is the meaning of garbage collection (Gabage Collection), memory processing is where programmers are prone to problems,
Forgotten or faulty memory recycling can cause a program or system to become unstable or even crash, and the GC functionality provided by Java automatically
If the object exceeds the scope to automatically reclaim memory, the Java language does not provide free allocated memory
The display action method.


--------------------------------------------------------
What is the rationale behind the garbage collector? Can the garbage collector reclaim memory right away? What is the way to proactively notify a virtual machine for garbage collection
A: For GC, when a programmer creates an object, the GC starts to monitor the address, size, and usage of the object. Typically, GC uses
All objects in the heap are recorded and managed in a map-to-graph manner. In this way, you determine which objects are "accessible" and which objects are "unreachable."
When the GC determines that some objects are unreachable, it is the responsibility of the GC to reclaim those memory spaces. OK. Programmers can manually execute System.GC (),
Notifies the GC to run, but the Java language specification does not guarantee that the GC will execute.

Java garbage collection mechanism

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.