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?