I need to write a large int[ ] from C to a Kotlin ...
# kotlin-native
l
I need to write a large int[] from C to a Kotlin IntArray in a performant way. Can I assume that an IntArray stores all values sequentially like a C int[] and memcpy the data to Pinned<IntArray>.addressOf(0), or could this break in future Kotlin Native releases?
j
I hope this is the behavior. I'm similarly reading and copying `ByteArray`s natively in this same way.
l
Have you had any memory issues come up as a result of this? Memory issues seem random at times and take a while to manifest, so I don’t know how to test this for sure.
j
Most of my code is pre-production, but I haven't noticed any memory issues yet. Here's an example where I'm doing these sorts of native memory reads and copies: https://github.com/square/okio/pull/1123