DEV Community

Discussion on: 🚀 Demystifying memory management in modern programming languages

Collapse
 
coolshaurya profile image
Shaurya

Nim has 6 GCs - The default one is a reference counting one. See the nim documentation for more details

Thread Thread
 
juancarlospaco profile image
Juan Carlos

Nim calls all of them "GC" to keep things simple for new users,
but Nim memory management strategies may or may not fit the "Garbage Collector" definition whatsoever.

Ive meet people that considers whatever Rust uses a Garbage Collector too.
🤷‍♀️

Thread Thread
 
deepu105 profile image
Deepu K Sasidharan • Edited

Thanks and Yes, I'm aware. They did go all the way on the GC part 😜

Technically they all fit under definition of GC IMO. They don't have ARC or Ownership as far as I see

Thread Thread
 
juancarlospaco profile image
Juan Carlos

--gc:arc

flat reference counting with move semantics and destructors with single ownership,
optimized with sink and lent annotations for zero-copy all the way is annotated,
basically it is like a shared heap with subgraphs with a single owner,
all this is done at compile-time, and ownership can be checked at run-time too.

Not really a GC despite --gc:.

Not really the same as Swift and ObjectiveC lang ARC because those can not handle cycles.

Not really Atomic despite ARC,
it wont need atomic reference counting,
a graph is always owned by a single owner,
then no need to make the reference counting atomic
(real atomic is known to be kinda slow).

Thread Thread
 
deepu105 profile image
Deepu K Sasidharan • Edited

Well, in that case, it's just bad grouping coz ARC is not GC. And seems these are buried in the docs somewhere.