https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

Rob

12/11/2023, 8:32 PM
Is there a way to gather runtime metrics on the number of running coroutines and where they were created/launched? The use case is finding leaked coroutines in a large code base. Thanks.
k

kevin.cianfarini

12/11/2023, 8:43 PM
If you’re on JVM you can install debug probes and dumpCoroutines. Nothing exists for other platforms yet at the moment.
👀 1
r

Rob

12/11/2023, 8:59 PM
That works nicely. Thank you.
n

Norbi

12/11/2023, 10:06 PM
There is a very old related feature request: https://github.com/Kotlin/kotlinx.coroutines/issues/1360
r

Rob

12/13/2023, 3:23 PM
Unfortunately this needs
java.lang.management.ManagementFactory
which isn't supported on Android.