- `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.
- `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.