Suresh Maidaragi
05/03/2024, 12:28 PMSuresh Maidaragi
05/03/2024, 12:31 PM.aar
to use in Native Android
we see native android app size is increase by just 5MB compare to iOS 45MBtylerwilson
05/03/2024, 12:35 PMconfigure(listOf(
iosArm64(),
iosX64(),
iosSimulatorArm64()
)) {
this.compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xallocator=mimalloc")
}
}
}
which really helped our app.
We also switched to Ktor 3 EAP which fixes some leaks in Ktor 2.x.Suresh Maidaragi
05/03/2024, 12:57 PMDo you have the ability to edit and rebuild the KMP frameworkNo
Did you run it in Instruments to see what is being allocated and not released?tried above snippet, post increasing the memory consumption even after exiting from feature still memory remains used..
tylerwilson
05/03/2024, 12:59 PMkpgalligan
05/03/2024, 4:20 PM1. the iOS framework size is ~45MBIs that on the dev machine folder or is that the binary impact on the device? I'm assuming that's on the dev machine. The "binary impact" of a framework on device is very different than the size of the framework on disk. If this is a "standard" KMP library and not Multiplatform Compose, 45m would be huge. Agree on trying updated GC. The GC has had significant improvements. KMP doesn't just have "general" memory issues. It definitely sounds like a leak. What is the code actually doing?
Suresh Maidaragi
05/04/2024, 4:37 AMis that on the dev machine folder or is that the binary impact on the device?
Suresh Maidaragi
05/04/2024, 4:39 AMkpgalligan
05/04/2024, 5:18 AMSuresh Maidaragi
05/04/2024, 5:30 AMI assume you're using Multiplatform Compose.Yes
Suresh Maidaragi
05/04/2024, 5:32 AMIf you're using MP Compose, you're also shipping skia and a bunch of other stuff. It is a technical compromise you need to be willing to make. Android doesn't have the same compromise. Long story.We are using skiko and MP compose and bunch other libraries
kpgalligan
05/04/2024, 5:34 AMSuresh Maidaragi
05/04/2024, 5:34 AMIf you're using MP Compose, you'll have a big binary baseline to accept. That's the compromise you'll need to accept. On the memory situation, that's likely due to hosting views that are doing relatively "extreme" memory things. Video, audio, etc. How they're hosted, viewed, and likely retained, might suggest where that memory is being consumed.Yes lazylist contains all of this once, and if we keep playing around list(scrolling up/down) memory keeps increasing and decreasing
Suresh Maidaragi
05/04/2024, 5:37 AMkpgalligan
05/04/2024, 5:37 AMkpgalligan
05/04/2024, 5:39 AMkpgalligan
05/04/2024, 5:41 AMkpgalligan
05/04/2024, 5:42 AMkpgalligan
05/04/2024, 5:44 AMSuresh Maidaragi
05/04/2024, 5:47 AMKevin Galligan [11:09 AM]
KMP allows flexibility. I'd make that specific view a "native" view. Swap the lazy list with a SwiftUI view, and just consume the data from KMP.
kpgalligan
05/04/2024, 2:29 PMexpect/actual
. On Android, do what you're doing now. On iOS, host a native view, SwiftUI or UIKit, and pass in the data. Then you just create the same list UI for iOS.
If I had to guess, UIKit would be the safer option. SwiftUI is "nice", but for certain types of views, UIKit is a more stable option. In the code lab we're doing, one step adds a map view. Doing that with SwiftUI is "unpleasant". So, that view is UIKit, but then there's a different view that we use SwiftUI.
https://touchlab.co/jetpack-compose-ios-interopkpgalligan
05/04/2024, 2:31 PMSuresh Maidaragi
05/05/2024, 5:20 AMSuresh Maidaragi
05/05/2024, 5:20 AMSuresh Maidaragi
05/05/2024, 11:50 AMPamela Hill
05/06/2024, 6:26 AMSuresh Maidaragi
05/06/2024, 10:28 AMElijah Semyonov
05/06/2024, 12:57 PMSuresh Maidaragi
05/06/2024, 2:26 PMXbinary=disableAllocatorOverheadEstimate=true
And GC threshold below 1k, runtime memory consumption increases and iOS system let crash the app.Suresh Maidaragi
05/13/2024, 5:12 AMDjuro
12/15/2024, 8:58 PMkpgalligan
12/15/2024, 10:43 PMUsing Compose multiplatform for developmentCMP adds significant binary size to support Skia/etc. It is an important consideration before choosing the technology. However, "significant" is in the neighborhood of 20-30 meg. KMP on its own doesn't add much proportionally over, say, writing it all in Swift, but that does depend on your config. Arguably, anyway. 100m of most just code would be quite a bit of code. What's the size breakdown of the app, and what part is just KMP/CMP?
Suresh Maidaragi
12/16/2024, 4:45 AM