How to determine whether my KMP application was closed properly? I mean I am using multiple coroutines in my KMP for desktop application mainly for Ktor receive bytes function but when I close the app I can see instances of Java (TM) Platform SE binary running even when I close my application. So I am wondering whether there are not some memory thread leaks. I have tried to add my debug function into the onCloseRequest for windows application. But It still shows some threads active:
Thread: Thread-8
Thread: AWT-Shutdown
Thread: main
Thread: AWT-EventQueue-0
I need to assure that there is no memory leak or background thread running in the Windows app nor the Android app. And I need to know how to achieve that in both platforms. In order to achieve that I need to know how to correctly distinguished what is some kind of system level and what is something I left behind.
onCloseRequest = {
activeThreads.forEach { t ->
if (!t.isDaemon) println("⚠️ Thread: ${t.name}")
}
})
},