3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-14 22:56:15 +00:00

Java bindings: Force cleaning the queue on context closing.

This commit is contained in:
George Karpenkov 2016-06-29 13:09:05 +02:00
parent 8aee7129f6
commit cb87991d5f
4 changed files with 67 additions and 47 deletions

View file

@ -59,6 +59,9 @@ public abstract class IDecRefQueue<T extends Z3Object> {
clear(ctx);
}
/**
* Clean all references currently in {@code referenceQueue}.
*/
protected void clear(Context ctx)
{
Reference<? extends T> ref;
@ -67,4 +70,14 @@ public abstract class IDecRefQueue<T extends Z3Object> {
decRef(ctx, z3ast);
}
}
/**
* Clean all references stored in {@code referenceMap},
* <b>regardless</b> of whether they are in {@code referenceMap} or not.
*/
public void forceClear(Context ctx) {
for (long ref : referenceMap.values()) {
decRef(ctx, ref);
}
}
}