How does the Phantom Reference work?

The API document says:

This reference type differs from others in that it is not intended to access the object, but as a signal that the object is already completed and the garbage collector is ready to return its memory.

If the Phantom link cannot be used to access the object, how does the garbage collector recover the memory used by this object?

+3
source share
2 answers

You can find this presentation from Bob Lee to be useful in demystifying various types of links ( slides ).

+5
source

Source: https://habr.com/ru/post/1733132/


All Articles