. NET garbage collection mechanism understanding

Source: Internet
Author: User

There are a lot of posts on the internet about garbage collection mechanism, here I mainly make an easy summary

First, the concept

Referred to as GC, English is all called garbage Collector, that is, the garbage collector, in my understanding, that is, the system memory is no longer used and do not need to use objects, these objects need to be recycled

Ii. managed resources and unmanaged resources

Managed resources: Resources on the managed heap,. NET 80% are managed resource unmanaged resources: Resources not on the managed heap, common Io Stream objects, string connection objects, and so on are unmanaged resources

Third, the scope of the GC

GC primarily reclaims managed resources, cannot release unmanaged resources, and GC is not real-time, and unmanaged resources need to be released manually

Iv. How to manually release unmanaged resources

Implement IDispose interface or using (higher performance)

. NET garbage collection mechanism understanding

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.