Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'd like to add that "circumventing the GC" is supported by default. There are 3 object types in Nim

- `type Foo = object` --> Value type, on the stack

- `type Foo = ref object` --> Reference type, managed by GC

- `type Foo = ptr object` --> Pointer type, manual memory management (with Nim's equivalent for malloc, free and memcopy)

Also Nim does not have 1 GC but several:

- Default Deferred Reference Counting - Not stop the world

- Boehm GC

- Mark and Sweep

- Memory Regions

- Real-time GC (with tunable max-pause)

- GC disabled

GC can also be deactivated per thread (setupForeignThreadGc) or for a section of the code (GC_ref, GC_unref) even on Ref types to improve interoperability with other languages.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: