3 ms·
Check this test out: https://github.com/vlang/v/blob/master/vlib/v/tests/valgrind/1.strings_and_arrays.v https://github.com/vlang/v/blob/master/vlib/v/tests/va
by amedvednikov 6y ago
Check this test out:
https://github.com/vlang/v/blob/master/vlib/v/tests/valgrind/1.strings_and_arrays.v https://github.com/vlang/v/blob/master/vlib/v/tests/valgrind...
It has lots of comments and will give you a good picture.
- vlang1dot0 6y agoI think having actual documentation about how the memory system is supposed to work would do a lot more to answer questions than linking to the tests. For example: x = [1, 2, 3] // is this stack or heap allocated? foo(&x) // how does the compiler know if x needs to be ref counted or not? return &x // is this valid or UB or a compilation error?