From: weiyu Date: Thu, 26 Sep 2019 23:57:17 +0000 (-0700) Subject: Need to free memory X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=35ebf30f42f46d47fbec1db62acc453733dfb2e1 Need to free memory --- diff --git a/classlist.h b/classlist.h index e528a47d..65ac08df 100644 --- a/classlist.h +++ b/classlist.h @@ -25,6 +25,7 @@ struct bug_message; typedef SnapList action_list_t; typedef SnapList func_id_list_t; typedef SnapList func_inst_list_t; +typedef HashTable inst_act_map_t; typedef HashSet PredSet; typedef HSIterator PredSetIter; diff --git a/funcnode.cc b/funcnode.cc index 5b5b9114..e08ca1b8 100644 --- a/funcnode.cc +++ b/funcnode.cc @@ -230,13 +230,14 @@ void FuncNode::update_predicate_tree(action_list_t * act_list) if (act_list == NULL || act_list->size() == 0) return; - /* map a FuncInst to the its predicate */ + /* Map a FuncInst to the its predicate */ HashTable inst_pred_map(128); - // number FuncInsts to detect loops + // Number FuncInsts to detect loops HashTable inst_id_map(128); uint32_t inst_counter = 0; + /* Only need to store the locations of read actions */ HashTable loc_act_map(128); HashTable inst_act_map(128); @@ -293,9 +294,9 @@ void FuncNode::update_predicate_tree(action_list_t * act_list) if (next_act->is_read()) { loc_act_map.put(next_act->get_location(), next_act); - inst_act_map.put(next_inst, next_act); } + inst_act_map.put(next_inst, next_act); inst_pred_map.put(next_inst, curr_pred); if (!inst_id_map.contains(next_inst)) inst_id_map.put(next_inst, inst_counter++); @@ -474,6 +475,12 @@ void FuncNode::generate_predicates(Predicate ** curr_pred, FuncInst * next_inst, (*curr_pred)->add_child(pred); pred->set_parent(*curr_pred); } + + /* Free memories allocated by infer_predicate */ + for (uint i = 0; i < half_pred_expressions->size(); i++) { + struct half_pred_expr * tmp = (*half_pred_expressions)[i]; + snapshot_free(tmp); + } } /* Amend predicates that contain no predicate expressions. Currenlty only amend with NULLITY predicates */ diff --git a/funcnode.h b/funcnode.h index 22d92835..5773d79d 100644 --- a/funcnode.h +++ b/funcnode.h @@ -9,7 +9,6 @@ #include "history.h" typedef ModelList func_inst_list_mt; -typedef HashTable inst_act_map_t; typedef enum edge_type { IN_EDGE, OUT_EDGE, BI_EDGE