Re:Crafting Interpreters
by kerkeslager on Sunday July 14, 2024 @05:29PM
(#40963318)
Yeah, "When to schedule?" is a really good question.
Have you ever contacted the authors of The Garbage Collection Handbook[1]? It seems like they intend that book to have the most breadth of knowledge about GC, and if there's anybody out there who has studied when to collect they might know who.
Re:Crafting Interpreters
by munificent on Sunday July 14, 2024 @05:56PM
(#40963500)
I haven't. That's a good idea. I'm pretty good at tracking down resources, but really bad at actually contacting humans.
Re:Crafting Interpreters
by kerkeslager on Sunday July 14, 2024 @06:19PM
(#40963620)
As a hobbyist freelancer with no access to resources like JSTOR, contacting the authors is often the only way I can obtain access to academic papers. It works great!
Incidentally, that book might contain information on when to GC; I haven't actually finished it yet.
Yes, that sounds like it would work fine to me. The only downside to keep in mind is that you will periods of time where you need to allocate more memory and have to do that first and then only free up memory in a GC after that allocation takes place. If you're very memory constrained or you need to allocate a lot, that could potentially be a problem.
But if I'm totally honest, I'm not sure how big of a problem that is in practice. One of the really annoying things about garbage collectors is how little literature there is on real-world collection strategies. You can find plenty of papers on collection algorithms, but it's hard to find material on when a GC should run.