#include "fdstream.h"
#include "../printer/printers.h"
#include "../cpp_interface/cpp_interface.h"
+#include "../extlib-abc/cnf_short.h"
//These typedefs lower the effort of using the keyboard to type (too
//many overloaded meanings of the word type)
persist.clear();
}
+ Cnf_ClearMemory();
+
delete decls;
delete (stpstar)vc;
BEEV::GlobalSTP = NULL;
namespace BEEV
{
+ int ToSATAIG::cnf_calls=0;
+
bool
ToSATAIG::CallSAT(SATSolver& satSolver, const ASTNode& input, bool needAbsRef)
{
if (bm->UserFlags.output_bench_flag)
cerr << "Converting to CNF via ABC's AIG package can't yet print out bench format" << endl;
- Cnf_ClearMemory();
- Cnf_DataFree(cnfData);
- cnfData = NULL;
+
+ // This releases the memory used by the CNF generator, particularly some data tables.
+ // If CNF generation is going to be called lots, we'd rather keep it around.
+ // because the datatables are expensive to generate.
+ if (cnf_calls != 0)
+ Cnf_ClearMemory();
+
+ cnf_calls++;
+
+ Cnf_DataFree(cnfData);
+ cnfData = NULL;
// Minisat doesn't, but simplifying minisat and cryptominsat eliminate variables during their
// simplification phases. The problem is that we may later add clauses in that refer to those