-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abandoned generator leaks memory #2190
Comments
Cc @tchaikov |
tchaikov
added a commit
to tchaikov/seastar
that referenced
this issue
May 4, 2024
this generator implementation is inspired by https://wg21.link/P2502R2. Refs scylladb#2190 Refs scylladb#1913 Refs scylladb#1677 Signed-off-by: Kefu Chai <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following test case (can be applied to tests/unit/coroutines_test.cc)
What it does is creates a my_generator, then co-awaits a single result out of it, then exists and (implicitly) destroys the generator. Generator itself, in turn, wants to generate two values, not one. But being destroyed early it leaks memory, reported in debug mode
line 556 here is the
auto q = make_shared<queue<std::optional<int>>>(16);
oneline 558 is the
return sleep(1s);
oneand few more
Making the test do
co_await gen()
in a loop until the generator drains itself solves leaksThe text was updated successfully, but these errors were encountered: