I'm studying coroutine now, and testing some difference with thread. stydying with the kotlin docs, I copied some test code and changed the code for testing thread.
the docs said https://kotlinlang.org/docs/coroutines-basics.html#coroutines-are-light-weight
If you write the same program using threads (remove runBlocking, replace launch with thread, and replace delay with Thread.sleep), it will likely consume too much memory and throw an out-of-memory error.
but I can't get anything about the error. Is there any problem in my code?
fun main() = runBlocking {
repeat(1000000) {
thread {
sleep(5000L)
print(".")
}
}
}