Mark-and-Sweep vs. Automatic Reference Counting [closed]
Asked Answered
M

0

18

As we all know, the HotSpot JVM uses a concurrent Mark-and-Sweep Garbage Collector to release unused objects on the heap. This is useful in a sense that programmers don't have to take care of memory while making their programs, but comes with an occasional 'GC lag' that releases all unused objects.

Likewise, the new Swift programming language also utilizes an automatic memory management system called ARC, which works with Automatic Reference Counting. The problem with this kind of garbage collection is cyclic references, which have to be handled specially by the programmer with weak and unowned references to avoid memory leaks.

But are there any other significant differences between the two? In which scenarios is one better or worse than the other?

Mensal answered 3/6, 2015 at 19:4 Comment(3)
Mark-Sweep probably has better overall performance; but Apple is probably more concerned with GC pause on a GUI app.Bister
How is the question primarily opinion-based when I'm asking for advantages and disadvantages and usage scenarios? The question is not which you find better, it's about which is more useful in specific cases or environments.Mensal
welcome to stackoverflow. most questions have 0 votes and 3 views. you are lucky enough to have 5 mods piling on you.Bister

© 2022 - 2024 — McMap. All rights reserved.