Join Slack
another question. does alloc<>() zero out the allocated memory or not?
# kotlin-native
m
mikehearn
09/28/2018, 7:05 PM
another question. does alloc<>() zero out the allocated memory or not?
r
r4zzz4k
09/28/2018, 7:16 PM
AFAICT, it should. (It was a bit surprising to find out that Kotlin's internal
malloc
actually uses
calloc
under the hood :) `nativeHeap.alloc()`:
https://github.com/JetBrains/kotlin-native/blob/master/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt#L34
`nativeMemUtils.alloc()`:
https://github.com/JetBrains/kotlin-native/blob/master/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/NativeMem.kt#L103
`Kotlin_interop_malloc`:
https://github.com/JetBrains/kotlin-native/blob/master/runtime/src/main/cpp/Natives.cpp#L55
o
olonho
09/28/2018, 7:28 PM
Yes, alloc return 0-inited values
10
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by