-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Documentation: fix OutOfMemoryError for the runnable samples #3631
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
Conversation
fd27dc4
to
e704af2
Compare
docs/topics/coroutines-basics.md
Outdated
('.') while consuming very little memory: | ||
|
||
```kotlin | ||
import kotlinx.coroutines.* | ||
|
||
fun main() = runBlocking { | ||
repeat(100_000) { // launch a lot of coroutines | ||
repeat(10_000) { // launch a lot of coroutines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is non-runnable, so there's no issue with 100_000
here. In this case, we intentionally highlight the difference from threads, and it's more important to have a whooping 100_000 coroutines here than to be able to use https://play.kotlinlang.org/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure I agree here. Should we at least change the wording, or warn that the playground doesn't handle this?
The reason I filed the bug KT-51515 over a year ago is because I was amazed when I saw this example, and immediately popped into the playground to see it in action. But of course it crashed and it leaves a bad impression about trusting the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we at least change the wording, or warn that the playground doesn't handle this?
I agree, we should at least add a warning. @danil-pavlov, could you help us with that?
e704af2
to
239cbaa
Compare
239cbaa
to
96b93a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
See KT-51515 for the details.