"Reprint" about. NET memory leaks

Source: Internet
Author: User

The so-called memory leak means that an object or variable that is no longer being used by the program is always occupied in memory. Net has a garbage collection mechanism that ensures that an object is no longer referenced when the object is programmed to orphan, and the object is automatically erased from memory by the garbage collector. Although. NET can reclaim useless objects,. NET still has a memory leak due to improper use. Memory leaks in. NET: Long life-cycle objects that hold references to short lifecycle objects are likely to have a memory leak, although short life-cycle objects are no longer needed, However, because a long life cycle object holds its reference and cannot be recycled, this is the occurrence of a memory leak in. Net, which, in layman's terms, is that the programmer may have created an object that is never used in the future, and that object has been referenced, which is useless but cannot be recycled by the garbage collector. This is a possible memory leak in. Net, for example, the caching system, where we load an object in the cache (for example, in a global Dictionary object), and then never use it again, the object has been cached and referenced, but it is no longer used.

"Reprint" about. NET memory leaks

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.