4 ms·
You can have manual control over memory if you want, though. This worked the last time I looked at the language, at least: foo = cast[ptr Foo](alloc(sizeof
by andolanra 11y ago
You can have manual control over memory if you want, though. This worked the last time I looked at the language, at least:
foo = cast[ptr Foo](alloc(sizeof(Foo)))
# do stuff with foo
dealloc(foo)
EDIT: Here's the documentation on the site itself. Most things are 'traced' by the GC, but by using alloc and dealloc you can work with 'untraced' (i.e. manually allocated) memory: http://nim-lang.org/0.11.0/manual.html#types-reference-and-pointer-types http://nim-lang.org/0.11.0/manual.html#types-reference-and-p...
- pcwalton 11y agoGo has unsafe.Pointer too.