https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

SrSouza

01/17/2023, 5:34 PM
Hi folks, I’m doing a PoC, trying to refactor a Android module to KMM to integrate in the iOS app. We are using Kotlin 1.7,10, I did enable the Expertimental Memory Management but any kotlin object allocation seems to crash the iOS app. iOS stacktrace and more information in the 🧵
#0 kotlin:mm:AllocateArray(kotlin:mm:ThreadData*, TypeInfo const*, unsigned int, ObjHeader**) () #2 Kotlin_ObjCExport_refFromObjC () #3 objc2kotlin.3101 at /<compiler-generated>:1 #6 Swift file and line that tries to instanciate a data class
Our gradle properties
Copy code
kotlin.native.binary.memoryModel=experimental
kotlin.native.binary.freezing=disabled
kotlin.native.cacheKind=none
cc @svyatoslav.scherbina
The project is being exported as XCFramework using the new
kotlinArtifacts
DSL.
s

svyatoslav.scherbina

01/17/2023, 5:47 PM
Hi. Well, that is clearly not enough to give any meaningful advice. Could you please provide assembly listings of frames 0-3, including the exact position in the listings?
s

SrSouza

01/17/2023, 6:03 PM
I was exporting the XCFramework to iOS with
isStatic = true
, seems that was the issue. This is expected @svyatoslav.scherbina?
s

svyatoslav.scherbina

01/17/2023, 6:21 PM
Do you use this XCFramework in multiple modules of your project? Is one of them a dynamic library/framework?
s

SrSouza

01/17/2023, 8:11 PM
Yes! But the usage for
isStatic = true
was not soemthing that I really need, is something that I configured that way without knowing. The integration did work, pretty happy with the result K
s

svyatoslav.scherbina

01/18/2023, 12:20 PM
Great, thank you for letting me know!
6 Views