3 ms·
Speaking of immutable languages, there are actually tricks in Haskell by which it can actually generate circular references because of its laziness (ML, on the
by thinkpad20 13y ago
Speaking of immutable languages, there are actually tricks in Haskell by which it can actually generate circular references because of its laziness (ML, on the other hand, is immutable and strict, so it cannot, by default anyway).
In regards to reference counting vs. garbage collection, one advantage to reference counting is that it can be more memory efficient, since objects do not unnecessarily accumulate in memory. It can be advantageous in embedded systems for this reason. GC can provide a speed boost at a memory usage cost, because `malloc` and `free` are relatively expensive, and using a garbage collector can reduce the number of these calls needed.