3 ms·
For reference, Java has PhantomReference and ReferenceQueue to let you detect when an object has been garbage-collected: https://docs.oracle.com/en/java/javase/
by nayuki 6y ago
For reference, Java has PhantomReference and ReferenceQueue to let you detect when an object has been garbage-collected: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ref/PhantomReference.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base... ; https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ref/ReferenceQueue.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base...
There's a decent chance that JavaScript will eventually copy these features and their design. So the current Java features offer a glimpse of what could happen.