By defining the symbol DD_DEBUG during compilation, numerous checks are added to the code. In addition, the procedures Cudd_DebugCheck , Cudd_CheckKeys , and cuddHeapProfile can be called at any point to verify the consistency of the data structure. ( cuddHeapProfile is an internal procedure. It is declared in cuddInt.h .) Procedures Cudd_DebugCheck and Cudd_CheckKeys are especially useful when CUDD reports that during garbage collection the number of nodes actually deleted from the unique table is different from the count of dead nodes kept by the manager. The error causing the discrepancy may have occurred much earlier than it is discovered. A few strategicaly placed calls to the debugging procedures can considerably narrow down the search for the source of the problem. (For instance, a call to Cudd_RecursiveDeref where one to Cudd_Deref was required may be identified in this way.)
One of the most common problems encountered in debugging code based on the CUDD package is a missing call to Cudd_RecursiveDeref . To help identify this type of problems, the package provides a function called Cudd_CheckZeroRef . This function should be called immediately before shutting down the manager. Cudd_CheckZeroRef checks that the only nodes left with non-zero reference counts are the predefined constants, the BDD projection functions, and nodes whose reference counts are saturated .
For this function to be effective the application must explicitly dispose of all diagrams to which it has pointers before calling it.