zoukankan      html  css  js  c++  java
  • Finalization / Freachable queue in .Net

    When an application instantiates a new object, if the object's type defines a Finalize method, a pointer to the object is placed on the finalization queue just before the type's instance constructor is called. The finalization queue is an internal data structure controlled by the garbage collector. Each entry in the list points to an object that should have its Finalize method called before the object's memory can be reclaimed.

    The garbage collector scans the finalization queue looking for pointers to the objects which are identified as garbage. And when found, it is moved to freachable queue which is another data structure maintained by garbage collector's internal. A special high-priority CLR thread is dedicated to calling Finalize methods and CLR uses a high priority thread to finalize these objects which appear in this freachable queue. The object in Freachable queue is reachable only to this finalization thread. So When writing the finalization method it should concentrate on disposing the local and native objects and shouldn't execute any that makes any assumptions about the thread that's executing the code.


    作者:ChenLuLouis
    出处:http://www.cnblogs.com/chenlulouis/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
    该文章也同时发布在我的独立博客中-chenlulouisBlog

  • 相关阅读:
    NABCD(校园包车)
    作业5.2~5.3
    作业5.1
    作业
    JAVA EE社团管理升级版-数据库设计
    JAVA EE社团管理升级版-微信小程序端说明文档
    社团项目软件展示
    社团项目个人总结
    北京地铁规划项目总结
    地铁出行线路规划项目设计
  • 原文地址:https://www.cnblogs.com/chenlulouis/p/2319285.html
Copyright © 2011-2022 走看看