Skip to content
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

Using future<>::detach() is a possible memory leak #134

Closed
sean-parent opened this issue Apr 13, 2018 · 1 comment
Closed

Using future<>::detach() is a possible memory leak #134

sean-parent opened this issue Apr 13, 2018 · 1 comment
Assignees

Comments

@sean-parent
Copy link
Member

{
auto p = package<int()>(immediate_executor, []{ return 42; });
p.second.then([a = annotate()](int x){ std::cout << x << '\n'; }).detach();
}

outputs:

annotate ctor
annotate move-ctor
annotate move-ctor
annotate move-ctor
annotate move-ctor
annotate dtor
annotate dtor
annotate dtor
annotate dtor

Notice we are one dtor short... detach() creates a retain cycle - this needs to be broken in the event of a broken promise exception (or any exception).

@FelixPetriconi
Copy link
Member

Fixed in 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants