Troubleshooting a java memory leak: finalization?

前端 未结 5 2233
难免孤独
难免孤独 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:41

    The item 7 of Effective Java second edition is: "Avoid finalizers". I strongly recommend you to read it. Here is an extract that may help you:

    "Explicit termination methods are typically used in combination with try-finally construct to ensure termination"

提交回复
热议问题