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:
parent
8aee7129f6
commit
cb87991d5f
4 changed files with 67 additions and 47 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue