Need clarification on memory access in Kotlin Native. Is memory access only available for the heap? If that is the case then stack memory access is missing.
It's not like that. Kotlin/Native is relatively high level language, and as such memory management doesn't explicitly specify where particular value is stored. For example, in code like
fun foo(arg: Int) {
val tmp = arg + 1
return tmp
}
both arg and tmp are stored on stack only, and no heap allocations take place. However, in general, it's up to compiler and runtime to decided, where to store data, as long, as it matches language contracts.
Given the current situation with the Kotlin Native documentation there is no separate documentation covering memory management (eg MEMORY_MANAGEMENT.md). Would be extremely helpful to have a separate document that includes the following:
We will try to improve situation in that regard, hopefully in v0.6 timeframe.
Obviously this is forgotten... such a documentation is really necessary; hopefully it can be finish in v0.8...
Please, don't forget about it, that's really important. A smart enough compiler should be able to decide which objects go to the heap and which can stay in the stack; that would be awesome and it wouldn't need any changes in the actual language.
Most helpful comment
Given the current situation with the Kotlin Native documentation there is no separate documentation covering memory management (eg MEMORY_MANAGEMENT.md). Would be extremely helpful to have a separate document that includes the following: