We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e860a2 commit 1bfc8c3Copy full SHA for 1bfc8c3
include/exec/static_thread_pool.hpp
@@ -447,13 +447,15 @@ namespace exec {
447
};
448
449
auto finalize = [&](auto&) {
450
- stdexec::set_value(
451
- (Receiver&&) sh_state.receiver_,
452
- std::reduce(
453
- std::ranges::begin(sh_state.partials_),
454
- std::ranges::end(sh_state.partials_),
455
- sh_state.init_,
456
- sh_state.redop_));
+ auto result = std::reduce(
+ std::ranges::begin(sh_state.partials_),
+ std::ranges::end(sh_state.partials_),
+ sh_state.init_,
+ sh_state.redop_);
+ // deallocate
+ std::vector<reduction_result_t> tmp;
457
+ sh_state.partials_.swap(tmp);
458
+ stdexec::set_value((Receiver&&) sh_state.receiver_, std::move(result));
459
460
461
sh_state.apply(reducer);
0 commit comments