How can I look for performance problems on macOS t...
# kotlin-native
a
How can I look for performance problems on macOS target? kotlin 1.4.10, ktor 1.4.1, coroutines 1.3.9-native-mt-2, serialization 1.0.0 I try to run some logic in different threads by
Copy code
val ctx1 = newSingleThreadContext("run1")
launch(ctx1) {
    run1()
}
val ctx2 = newSingleThreadContext("run2")
launch(ctx2) {
    run2()
}
But I’ve found that different logics in different contexts can’t work in same time - when I turn off run2 feature - run1 works faster. How can I run some code (with coroutines support) in another thread? PS: run1 - ktor/curl client, run2 - file operations. PPS: I’ll migrate to serialization 1.0.1 today but (I think) it doesn’t matter.
Maybe it’s a memory-leak in my code. How can I look for this in native?
n
You could try with the Leaks detector in Instruments which is included in Xcode. This will show if you are leaking ObjC/Swift objects. It also tracks general memory allocations (e.g. using
malloc()
) but I'm not sure it will show you Kotlin Native allocations as it might be using a custom allocator.