[CxxWeaver] Fixes memory leak, was not freeing AST after each run in GUI
@@ -223,9 +223,10 @@ public class CxxWeaver extends ACxxWeaver {
public CxxWeaver() {
// Weaver configuration
args = null;
- // app = null;
- apps = new ArrayDeque<>();
- userValuesStack = new ArrayDeque<>();
+ apps = null;
+ // apps = new ArrayDeque<>();
+ userValuesStack = null;
+ // userValuesStack = new ArrayDeque<>();
// outputDir = null;
sources = null;
@@ -303,6 +304,9 @@ public class CxxWeaver extends ACxxWeaver {
@Override
public boolean begin(List<File> sources, File outputDir, DataStore args) {
+ apps = new ArrayDeque<>();
+ userValuesStack = new ArrayDeque<>();
+
accMap = new AccumulatorMap<>();
// Logger.getLogger(LoggingUtils.INFO_TAG).setLevel(Level.WARNING);
@@ -624,6 +628,9 @@ public class CxxWeaver extends ACxxWeaver {
messagesToUser.forEach(ClavaLog::info);
}
+ // Remove app from deque
+ popAst();
+
return true;
}
