Garbage Collection every 100 seconds

后端 未结 12 1356
深忆病人
深忆病人 2021-02-03 11:32

Did any one encountered a scenario where application under high memory allocation load performed second generation collection every 100 seconds ?

We using 64-bit server

12条回答
  •  死守一世寂寞
    2021-02-03 12:03

    I assume this is for .net.

    GC collects when it wants to base on its algorithm. You can suggest the garbage collector to collect but it may not actually do anything.

    you can use GC.Collect() to ask the GC to look if garbage can be collected. However it may not actually remove items from memory.

    NOTE: Also, make sure you are clearing references correctly. Meaning unhooking events, Clearing references between objects. This will help the GC in collected objects that are no longer in scope.

提交回复
热议问题