<https://youtrack.jetbrains.com/issue/CMP-8223/Kot...
# multiplatform
g
I used native C functions to capture the stack trace and wrote them in my own native function. It doesn't cause a memory leak. Unfortunately, I don't have access to Kotlin's internal Throwable, so instead, I wrote a function that attaches a native stack trace to a Throwable. If it's your own exception, you can attach the stack trace right before throwing it. Otherwise, you need to find the nearest place where a third-party library throws an exception, catch it in a try-catch block, attach the native stack trace, and then rethrow the error. To display the stack trace wherever you need it, you'll have to write some custom code. For example, I forked the Napier library so I could replace the part where it uses printStackTrace with my own function.