More code towards freeing old actions
[c11tester.git] / model.cc
index a934d0adcb7be451907d3141243f4239564743d2..7ae63b69334c1a35faae4d94a4dde0fcf5be4c7b 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -392,11 +392,19 @@ void ModelChecker::run()
        //Need to initial random number generator state to avoid resets on rollback
        char random_state[256];
        initstate(423121, random_state, sizeof(random_state));
-
+       modelclock_t checkfree = params.checkthreshold;
        for(int exec = 0;exec < params.maxexecutions;exec++) {
                Thread * t = init_thread;
 
                do {
+                       /* Check whether we need to free model actions. */
+
+                       if (params.traceminsize != 0 &&
+                                       execution->get_curr_seq_num() > checkfree) {
+                               checkfree += params.checkthreshold;
+                               execution->collectActions();
+                       }
+
                        /*
                         * Stash next pending action(s) for thread(s). There
                         * should only need to stash one thread's action--the