Under what circumstances, we need to call GC.Collect twice

前端 未结 4 2161
离开以前
离开以前 2020-12-01 11:33

We have a WPF application, based on Unity with MMVVVM pattern. In application life cycle there can be several project life cycles, after each project life cycle we do a manu

4条回答
  •  天涯浪人
    2020-12-01 12:09

    Sounds like you have something with a finalizer, basically - if you only call GC.Collect() once, the finalizers are finishing but the finalized objects aren't being collected.

    Whether or not that represents a bug is a different matter. Generally it's not a good idea for there to be finalizers which actually need to be executing, but maybe it's okay in your case.

提交回复
热议问题