Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Commit

Permalink
Free memory in FilCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Gashmob committed Jul 24, 2023
1 parent 8c9344c commit 00a4305
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/FilCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace filc {
return 1;
}

std::for_each(futures.begin(), futures.end(), [collector, this](std::future<filc::ast::Program *> &fut) {
for (auto &fut: futures) {
fut.wait();
filc::ast::Program *program = fut.get();
auto module_name = program->getModule();
Expand All @@ -74,7 +74,7 @@ namespace filc {
new filc::message::Message(filc::message::DEBUG, "Getting module: " + module_name)
);
}
});
}

if (collector->hasErrors()) {
collector->printAll();
Expand All @@ -83,6 +83,12 @@ namespace filc {
}
collector->printAll();

// Free memory
for (const auto &module: _modules) {
delete module.second;
}
_modules.clear();

return 0;
}
}

0 comments on commit 00a4305

Please sign in to comment.