Skip to content

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

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

nikpachoo
Copy link
Contributor

See KT-51515 for the details.

@nikpachoo nikpachoo force-pushed the kt-51515-fix-runnable-samples branch from fd27dc4 to e704af2 Compare February 20, 2023 12:19
('.') 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
Copy link
Collaborator

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/.

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.

Copy link
Contributor Author

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?

@nikpachoo nikpachoo force-pushed the kt-51515-fix-runnable-samples branch from e704af2 to 239cbaa Compare February 20, 2023 13:03
@nikpachoo nikpachoo force-pushed the kt-51515-fix-runnable-samples branch from 239cbaa to 96b93a4 Compare February 20, 2023 13:04
Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

Thanks!

@dkhalanskyjb dkhalanskyjb merged commit 28271c4 into master Feb 20, 2023
@dkhalanskyjb dkhalanskyjb deleted the kt-51515-fix-runnable-samples branch February 20, 2023 14:19
@elizarov elizarov mentioned this pull request Feb 28, 2023
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.

3 participants