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

Useless? These algorithms may be simple but they're not toys. This stuff has been used in production. You can certainly improve it but it's not "useless".


In production such a toy GC, without threading support and without register scanning? Imprecise also. How do you seperate large ints from pointers?

Brave.


It’s a learning exercise man. Congratulations, you are very smart. FWIW, all of your questions are addressed in the article


> In production

Did you know Ruby has a garbage collector not unlike this one? People are running it in production right now.

> a toy GC

It does its job. These algorithms have been working for decades now.

> without threading support

It can just stop the whole world.

> without register scanning

Add some inline assembly to spill all the registers. I did this on my own language implementation not even a month ago. If this was a real project I'd submit a patch.

The author even acknowledged this limitation and hinted at how to solve it, he just didn't want to get into those gritty details in his article. I'm happy to demonstrate if you want.

> Imprecise also. How do you seperate large ints from pointers?

You don't. You collect conservatively. It will have false positives but not false negatives. In other words, it will mistake some ints for pointers but it won't collect memory that's in use. Correct if suboptimal behavior.




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

Search: