4 ms·
It's optional (so you can turn it off if you'd like) https://nim-lang.org/docs/gc.html https://nim-lang.org/docs/gc.html
by metasyn 6y ago
It's optional (so you can turn it off if you'd like)
https://nim-lang.org/docs/gc.html https://nim-lang.org/docs/gc.html
- vips7L 6y agoHow do you manage memory then? Linking to libc and malloc/free?
- lr1970 6y agoYes, if you want to operate in "unsafe" mode you can manage memory yourself with pointers and malloc/free. But it is rarely needed in practice. Also, Nim compiles to C or C++ (and also to Javascript). Because of that Nim's C/C++ FFI is natural ans wrapper-free.
- kupopuffs 6y ago--gc:arc. Plain reference counting with move semantic optimizations, offers a shared heap. It offers deterministic performance for hard realtime systems. Reference cycles cause memory leaks, beware. --gc:orc. Same as -gc:arc but adds a cycle collector based on "trial deletion". Unfortunately that makes its performance profile hard to reason about so it is less useful for hard realtime systems. --gc:none. No memory management strategy nor garbage collector. Allocated memory is simply never freed. You should use --gc:arc instead. Nim offers alloc, dealloc, allocShared, deallocShared
- svrb 6y agoSo in other words Nim does not actually offer a true compile-time memory management feature like Rust does? I'm afraid my impression of a language only decreases when I see its supporters dodge an issue like this...