Garbage Collection every 100 seconds

后端 未结 12 1361
深忆病人
深忆病人 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条回答
  •  -上瘾入骨i
    2021-02-03 11:47

    That the garbage collector is being invoked frequently is not in itself necessarily a huge issue - it could however be a flag that you are not optimally handling your memory well (for instance not passing massive strings by reference into methods).

    Garbage collection should be non-deterministic. That noted, if you are running a number of critical tasks, but your thread(s) are sleeping at some juncture (like every 100 seconds) it is reasonable that the garbage collector may take the opportunity to collect at that point. More likely is that the consumption due to allocation peaks at more-or-less regular intervals and the garbage collector is invoked to retrieve unused memory.

    I highly suggest profiling the memory consumption of your application.

提交回复
热议问题