Grisson's .net

源码之前,了无秘密

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

作者在这个Item的最后一段很好总结了,关于垃圾最少化的技术。
摘如:
   The Garbage Collector does an efficient job of managing the momory that your application uses.But remember that creating and destroying heap object still takes times.

    1. Avoid create excessive objects;don't create what you don't need     

                                                                                                                       
    2. Also avoid creating multiple objects of reference types in local functions.

    3. Instead consider promoting local variable to member variables,   or create static objects of the most common instance of   your types.

    4. Finally,consider creating mutable builder classes for immutable type.
posted on 2005-08-15 11:25  海盗  阅读(262)  评论(0编辑  收藏  举报