summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-06-18 12:21:02 -0700
committerGitHub <noreply@github.com>2020-06-18 12:21:02 -0700
commit7d16d25dc9c527848eddac8414db22fe63b38e59 (patch)
treef56c6c16ad424bd6b90c629aa25584a72e6d5acf /src/util
parentc752258539ddb4c97b4fcbe7481cb1151ad182d0 (diff)
Improve memory management in Java bindings (#4629)
Fixes #2846. One of the challenges of the Java bindings is that the garbage collector can delete unused objects at any time in any order. This is an issue with CVC4's API because we require all `Expr`s to be deleted before the corresponding `ExprManager`. In the past, we were using `NewGlobalRef`/`DeleteGlobalRef` on the wrapper object of `ExprManager`. The problem is that we can have multiple instances of the wrapper that internally all refer to the same `ExprManager`. This commit implements a different approach where the Java wrappers hold an explicit reference to the `ExprManager`. The commit also removes some unused or unimportant API bits from the bindings.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/proof.i2
-rw-r--r--src/util/statistics.i4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/util/proof.i b/src/util/proof.i
index 22dff1043..59a524a0f 100644
--- a/src/util/proof.i
+++ b/src/util/proof.i
@@ -2,4 +2,6 @@
#include "util/proof.h"
%}
+%ignore CVC4::Proof::toStream(std::ostream& out, const ProofLetMap& map) const;
+
%include "util/proof.h"
diff --git a/src/util/statistics.i b/src/util/statistics.i
index 8d1086dcc..7dfc7ec39 100644
--- a/src/util/statistics.i
+++ b/src/util/statistics.i
@@ -64,12 +64,12 @@
%include <std_pair.i>
%include <std_string.i>
-%include <std_vector.i>
-%include "bindings/java_iterator_adapter.h"
%include "util/sexpr.h"
%template(Statistic) std::pair<std::string, CVC4::SExpr>;
+
+%feature("valuewrapper") CVC4::JavaIteratorAdapter<CVC4::StatisticsBase, std::pair<std::string, CVC4::SExpr> >;
%template(JavaIteratorAdapter_StatisticsBase) CVC4::JavaIteratorAdapter<CVC4::StatisticsBase, std::pair<std::string, CVC4::SExpr> >;
#endif /* SWIGJAVA */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback