diff --git a/src/api/java/IDecRefQueue.java b/src/api/java/IDecRefQueue.java index 5a80adf5f..2deb9c0f9 100644 --- a/src/api/java/IDecRefQueue.java +++ b/src/api/java/IDecRefQueue.java @@ -24,8 +24,17 @@ import java.util.IdentityHashMap; import java.util.Map; /** + * A queue to handle management of native memory. * - * @param + *

Mechanics: once an object is created, a metadata is stored for it in + * {@code referenceMap}, and a {@link PhantomReference} is created with a + * reference to {@code referenceQueue}. + * Once the object becomes strongly unreachable, the phantom reference gets + * added by JVM to the {@code referenceQueue}. + * After each object creation, we iterate through the available objects in + * {@code referenceQueue} and decrement references for them. + * + * @param Type of object stored in queue. */ public abstract class IDecRefQueue { private final ReferenceQueue referenceQueue = new ReferenceQueue<>();