Comment

Comment by vardump

> Garbage collection just shifts some of the responsibility, which means that garbage collector dictates part of the algorithm.

No. In this case it allows cheap, (mostly) unsynchronized deallocation. Otherwise you'll have to synchronize object deletion. Not only can that be tricky to get right (use-after-free hazard), but the required synchronization consumes a lot of CPU cycles. Ask any C++ programmer.

With (limited) GC, you only need to trace reachability to free the objects, avoiding almost all of the expensive synchronization operations.

You don't even need to use GC in general case, just for the data structures.

parent vardump 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton