Why do finalizers have a “severe performance penalty”?

前端 未结 6 1997
花落未央
花落未央 2020-12-03 04:44

Effective Java says :

There is a severe performance penalty for using finalizers.

Why is it slower to destroy an object using t

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 05:34

    One reason I can think of is that explicit memory cleanup is unnecessary if your resources are all Java Objects, and not native code.

提交回复
热议问题