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

Futures in Scala 2.12: Part 6 — unit and never #8

Merged
merged 1 commit into from
Feb 29, 2016

Conversation

viktorklang
Copy link
Owner

No description provided.

viktorklang added a commit that referenced this pull request Feb 29, 2016
Futures in Scala 2.12: Part 6 — unit and never
@viktorklang viktorklang merged commit 643fa44 into master Feb 29, 2016
@viktorklang viktorklang deleted the wip-futures-part6-√ branch February 29, 2016 13:41

Well, what happens is that the logic is *packaged* and added to the `neverCompletingFuture` instance in order to be executed when `neverCompletingFuture` completes (which is never), and now we have a hard to spot invisible memory leak!

So, in order to support the case when you want to be able to represent a `Future` which never completes, but also doesn't leak memory when used as a plain `Future`, use `Future.never`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to see some implementation details (code), explaining how memory leaks are avoided
like you have flatMap implementation in part 4 https://github.com/viktorklang/blog/blob/master/Futures-in-Scala-2.12-part-4.md#missing-canonical-combinators-transformwith

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

Successfully merging this pull request may close these issues.

2 participants