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

> * You're never going to get latency spikes by adding a counter to each allocation slot.

The suggestion wasn't just the counter though. A counter by itself does nothing. At some point you need to iterate[1] through your set to identify[2] the unreferenced[3] blocks. And that has to be done with some kind of locking vs. the unrestricted contexts elsewhere trying to do their own allocation work. And that has costs.

Bottom line is that the response was isomorphic to "That's OK, you can work around it by writing a garbage collector". And... yeah. We have that, and it's better than this nonsense.

[1] "sweep", in the vernacular

[2] "collect", in some idioms

[3] Yup, "garbage"



No, sorry, in case I wasn't clear, I was talking about manual deallocation. I wasn't talking about a garbage collector. You still allocate and free cells. Here's an example of what I am talking about:

https://docs.rs/generational-arena

If you're implementing a tracing garbage collector you obviously don't need any such counters to detect use-after-frees.

This is clearly a different compromise entirely to the one made by tracing garbage collection. I'm actually not sure how you confused the two.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: