A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Make this example valgrind-clean
[simgrid.git]
/
examples
/
cpp
/
dag-scheduling
/
s4u-dag-scheduling.cpp
diff --git
a/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp
b/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp
index
3feed78
..
ff68f38
100644
(file)
--- a/
examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp
+++ b/
examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp
@@
-95,6
+95,7
@@
static void schedule_on(sg4::ExecPtr exec, sg4::Host* host, double busy_until =
{
exec->set_host(host);
// We use the user data field to store up to when the host is busy
+ delete host->get_data<double>(); // In case we're erasing a previous value
host->set_data(new double(busy_until));
// we can also set the destination of all the input comms of this exec
for (const auto& pred : exec->get_dependencies()) {
@@
-191,6
+192,10
@@
int main(int argc, char** argv)
e.run();
}
+ /* Cleanup memory */
+ for (auto const& host : e.get_all_hosts())
+ delete host->get_data<double>();
+
XBT_INFO("Simulation Time: %f", simgrid_get_clock());
return 0;