Phantom Referenced Objects

前端 未结 6 1023
悲哀的现实
悲哀的现实 2021-02-15 20:04

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:12

    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.

提交回复
热议问题