Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can make garbage collection deterministic. Tracing collectors can be designed to accept a timeout so you can "collect" during downtime and resume execution on a predictable schedule. And with reference counting the cost of RC bookkeeping is smeared predictable across the run of the program. The real problem is many GC implementations lack customization and you're stuck with whatever GC algorithm the language implementers pick.


> And with reference counting the cost of RC bookkeeping is smeared predictable across the run of the program.

The biggest downside of naive reference counting usually isn't the cost of reference counting itself, it's being left stuck holding the bag when you're unlucky enough to be the last deref on a giant object graph. You can move the destruction onto a separate finalizer thread like what most runtimes that use tracing GCs do, but then you end up running into CPU scheduling issues if you're not overprovisioned.


There’s much more to it than you say.

The real problem is most GCs are built with a “throughput first” mindset and determinism is bolted on.

The details of how to build a deterministic GC are beyond the scope of a HN post lol


You can do RC memory management without the overhead of a GC runtime though.


As described (ie. only run when I say so), the GC is less overhead than ref counting because you're not even paying for the cost to free things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: