Difference between background and concurrent garbage collection?

后端 未结 3 1138
挽巷
挽巷 2020-12-13 02:29

I read that with .NET Framework 4 the current garbage collection implementation is replaced:

The .NET Framework 4 provides background garbage collec

3条回答
  •  [愿得一人]
    2020-12-13 02:52

    Here is the real world explanation without slur and overinflated feeling of self-importance:

    In concurrent GC you were allowed to allocate while in a GC, but you are not allowed to start another GC while in a GC. This in turn means that the maximum you are allowed to allocate while in a GC is whatever space you have left on one segment (currently 16 MB in workstation mode) minus anything that is already allocated there).

    The difference in Background mode is that you are allowed to start a new GC (gen 0+1) while in a full background GC, and this allows you to even create a new segment to allocate in if necessary. In short, the blocking that could occur before when you allocated all you could in one segment won’t happen anymore.

    From Tess da Man! http://blogs.msdn.com/b/tess/archive/2009/05/29/background-garbage-collection-in-clr-4-0.aspx

提交回复
热议问题