cleanUnusedNodes Not Removing Nodes
I've been using cleanUnusedNodes
in code like the following:
DD univ = c.makeFalse();
DD conj = c.makeFalse();
for (int i = 0; i < 500; i++) {
DD newVar = c.makeVariable();
if (i % 3 == 0) conj = c.makeOr(conj, newVar);
if (i % 2 == 0) univ = c.makeAnd(univ, newVar);
else univ = c.makeOr(univ, newVar);
}
univ = c.makeAnd(conj, univ);
univ = null;
conj = null;
System.gc();
c.cleanUnusedNodes();
I would have expected the number of nodes at the end of the code snippet to be the same as the beginning, but when printing them out, this was not as expected. For example, at the start of the code snippet, there were 2 nodes. After the univ = c.makeAnd(conj, univ);
line, there were 118777 nodes. After the c.cleanUnusedNodes();
line, there were 35515 nodes.
It looks like the garbage collector has run (printing out memory statistics before and after System.gc()
indeed makes it seem like this is the case), and clearly some nodes have been cleaned up. Why aren't all the new nodes cleaned up?