Commit 73718b1c authored by Dominik Charousset's avatar Dominik Charousset

Fix memory leak in `split_join` policy

parent 5b1834de
...@@ -48,21 +48,22 @@ public: ...@@ -48,21 +48,22 @@ public:
behavior make_behavior() override { behavior make_behavior() override {
return { return {
// first message is the forwarded request
others >> [=] { others >> [=] {
rp_ = make_response_promise(); auto rp = this->make_response_promise();
split_(workset_, current_message()); split_(workset_, this->current_message());
// first message is the forwarded request for (auto& x : workset_)
for (auto& x : workset_) { this->send(x.first, std::move(x.second));
sync_send(x.first, std::move(x.second)).then( this->become(
others >> [=] { // collect results
join_(value_, this->current_message()); others >> [=] {
if (--awaited_results_ == 0) { join_(value_, this->current_message());
rp_.deliver(make_message(value_)); if (--awaited_results_ == 0) {
quit(); rp.deliver(make_message(value_));
} quit();
} }
); }
} );
// no longer needed // no longer needed
workset_.clear(); workset_.clear();
} }
...@@ -75,7 +76,6 @@ private: ...@@ -75,7 +76,6 @@ private:
Join join_; Join join_;
Split split_; Split split_;
T value_; T value_;
response_promise rp_;
}; };
struct nop_split { struct nop_split {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment