diff --git a/src/main/gov/nasa/jpf/search/heuristic/HeuristicSearch.java b/src/main/gov/nasa/jpf/search/heuristic/HeuristicSearch.java index ae05396f..ff5e90e5 100644 --- a/src/main/gov/nasa/jpf/search/heuristic/HeuristicSearch.java +++ b/src/main/gov/nasa/jpf/search/heuristic/HeuristicSearch.java @@ -55,12 +55,18 @@ public abstract class HeuristicSearch extends Search { */ protected boolean isBeamSearch; + /* + * allocate childStates on needed (useChildStates == true) + */ + protected boolean useChildStates; + public HeuristicSearch (Config config, VM vm) { super(config, vm); useAstar = config.getBoolean("search.heuristic.astar"); isBeamSearch = config.getBoolean("search.heuristic.beam_search"); + useChildStates = config.getBoolean("search.heuristic.child_states"); } @@ -104,8 +110,9 @@ void backtrackToParent () { * explicit termination request */ protected boolean generateChildren () { - - childStates = new ArrayList(); + if (useChildStates) { + childStates = new ArrayList(); + } while (!done) { @@ -146,7 +153,9 @@ protected boolean generateChildren () { HeuristicState newHState = queueCurrentState(); if (newHState != null) { - childStates.add(newHState); + if (useChildStates) { + childStates.add(newHState); + } notifyStateStored(); } }