/** Copyright (c) 2012-2014 Microsoft Corporation Module Name: IDecRefQueue.java Abstract: Author: @author Christoph Wintersteiger (cwinter) 2012-03-15 Notes: **/ package com.microsoft.z3; import java.lang.ref.PhantomReference; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.util.IdentityHashMap; import java.util.Map; /** * A queue to handle management of native memory. * *
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