https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
k

Krystian

10/04/2023, 5:03 PM
Does Kotlin or Kotlin/Native specifically I suppose have an array that stores its elements in a contiguous block of memory? Something like Swifts ContiguousArray? Or is would the standard Array be the closest bet?
k

kevin.cianfarini

10/04/2023, 5:36 PM
I am happy to be schooled here, but my understand is that in Kotlin, high level collection types like
List<T>
are guaranteed to be stored in contiguous blocks of memory, but
Array<T>
and primitive array types are. That’s why arrays have to have a pre-defined size as they’re being allocated as a single block of memory up front.