3 ms·
Curious as to when you had this problem, I thought the manual was fairly descriptive: https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types ht
by arc776 9y ago
Curious as to when you had this problem, I thought the manual was fairly descriptive: https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types https://nim-lang.org/docs/manual.html#types-reference-and-po...
I'm sure your original question was more nuanced, but for anyone wondering about this basically any ref type is heap allocated, and you do this by calling new, so:
type MyType = ref object
var myHeapObject: MyType
new myHeapObject
Pretty much anything else is stack allocated and doesn't need the GC if I remember right.