C ++ garbage collection mechanism

Source: Internet
Author: User

StandardC ++There is no garbage collection mechanism:

1)No common base class

C ++ is developed from C. It allows direct pointer operations and conversion of one type to another. For a pointer, it cannot know the type it actually points; java or C # both have a common base class.

 

2)System overhead

The system overhead caused by garbage collection does not conform to the efficient features of C ++, making it not suitable for the underlying work.

 

3)Memory consumption

C ++ generates very little memory in the age, and the garbage collection mechanism needs to occupy more memory.

 

4)Alternative Method

C ++ has destructor, smart pointer, and reference count to manage resource release, which is not urgent for GC.

 

Related Article

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.