Phantom Referenced Objects

前端 未结 6 1546
星月不相逢
星月不相逢 2021-02-15 19:49

Phantom References serve for post-mortem operations. The Java specification states that a phantom referenced object will not be deallocated until the phantom-re

6条回答
  •  甜味超标
    2021-02-15 20:29

    Edit, since I've misunderstand the question first:

    Quoted from here http://www.memorymanagement.org/glossary/p.html:

    The Java specification says that the phantom reference is not cleared when the reference object is enqueued, but actually, there's no way in the language to tell whether that has been done or not. In some implementations, JNI weak global references are weaker than phantom references, and provide a way to access phantom reachable objects.

    But I found no other references which would say the same.

提交回复
热议问题