3 ms·
Unfortunately I can't remember the details at this point. There was something I couldn't figure out with the `new` function and heap allocation in general, and
by mikebenfield 9y ago
Unfortunately I can't remember the details at this point. There was something I couldn't figure out with the `new` function and heap allocation in general, and I also got frustrated trying to understand some things about the type system. I do know one thing about `new` was that it took me forever to figure out how to allocate anything on the heap at all, only to find a couple lines about `new` in the API docs. At least, I think that's what happened.
Sorry I can't be more specific.
- dom96 9y agoNo worries, thank you for replying :)
- arc776 9y agoCurious 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.