Troubleshooting a java memory leak: finalization?

前端 未结 5 2226
难免孤独
难免孤独 2020-12-31 05:27

I have a misbehaving application that seems to leak. After a brief profiler investigation, most memory (80%) is held by java.lang.ref.Finalizer instances. I sus

5条回答
  •  无人及你
    2020-12-31 05:44

    i have once see a similar problem, that is the finalizer thread can not catch up with the rate of generating finalizable objects.

    my solution is the make a closed loop control, by use the MemoryMXBean .getObjectPendingFinalizationCount(), a PD( proportinal and diffrential) control algo to control the speed we generate the finalizable objects, since we have a single entry to create it, just sleep number of seconds with the result of pd algo. it works well, though you need to tune the paramter for pd algo.

    hope it helps.

提交回复
热议问题