5 ms·
Putting both under the same term is meaningless. Reference counting and Garbage Collection have very clear difference: when the referenced objects are destroye
by viktorcode 4y ago
Putting both under the same term is meaningless.
Reference counting and Garbage Collection have very clear difference: when the referenced objects are destroyed (not deallocated). In RC it happens when the count reaches zero. In GC it happens some time later. That difference is crucial for having or not having deterministic performance in your program.
- Animats 4y ago> In GC it happens some time later. Yes. In languages with destructors/finalizers called from the garbage collector, things can get very complicated. C# and Java have this problem. Go avoids it by having scope-based "defer" rather than destructors.
- pjmlp 4y agoJava has scope based defer since version 7, while C# has it since version 4, with the improvement on version 8 to be syntactically like defer. With a bit of generics and lambdas, they can be made to even be more defer like.
- brabel 4y agoIs the Pony language's GC a GC then? It runs at determinate times, namely when a behaviour (an actors' receive function, basically) finishes running... and because actors cannot share mutable state, and immutable values with more than one owner can be handled easily by a simple common parent actor, each actor's GC is completely independent of each other. Things are rarely as clear cut as we would want to believe.
- viktorcode 4y ago> Is the Pony language's GC a GC then? It runs at determinate times, namely when a behaviour (an actors' receive function, basically) finishes running... It is. It might run when a behaviour finishes running, according to their docs.
- pjmlp 4y agoChapter 5, https://gchandbook.org/ https://gchandbook.org/