3 ms·
Garbage collection is contrarian
- eru 9mo agoCompare also 'A Unified Theory of Garbage Collection' https://web.eecs.umich.edu/~weimerw/2008-415/reading/bacon-garbage.pdf https://web.eecs.umich.edu/~weimerw/2008-415/reading/bacon-g...
- antonvs 9mo agoJust intuitively, this seems to be using a feature designed to guarantee safety in a way that doesn’t guarantee safety, which raises questions about what the point is.
- aapoalas 9mo agoAuthor here: to get the compiler to help me as the programmer to produce correct code (not accidentally using handles after GC) without being massively manual, but (at least currently) accepting that it is not a guarantee and thus runtime checks (bounds checks in my case) are needed to retain memory safety.
- _3u10 9mo agoJust use unsafe then you have all of the good points of rust, like being able to say you wrote it in rust with none of the downsides, like having to write safe code in rust, or that code being slow.
- eru 9mo agoYou can write slow unsafe Rust just fine.
- shevy-java 9mo agoThis reminds me of the old Monty Python sketch: https://www.youtube.com/watch?v=uLlv_aZjHXc https://www.youtube.com/watch?v=uLlv_aZjHXc (Argument Clinic)
- 4782626292283 9mo agoNo, it doesn't!
- anArbitraryOne 9mo agoI clicked on this hoping is was about physical garbage collection
- aapoalas 9mo agoI aim to displease!
- deleted 9mo ago[deleted]
- illuminator83 9mo agoI'm hoping for a future in which humankind looks back with embarrassment at this silly period in its history in which people used to think a leaky and bad abstractions like garbage collection was ever a good approach to deal with resource life-times.
- aziis98 9mo agoStill the whole world runs on GC-ed languages so it must be an abstraction at least some people like to work with. And I'm pretty sure using a GC in some cases it's the only option to not go crazy.
- illuminator83 9mo agoI think we are just used to it. Like we are used to so many suboptimal solutions in our professional and personal lives. I mean, look something like C++ or the name "std::vector" specifically. There are probably 4 Trillion LoC containing this code out there - in production. I'm used to it, doesn't make it good.
- immibis 9mo agoDid you know the Linux kernel has a tracing garbage collector in it, specifically for Unix socket handles? It seems to be a recurring solution to a common problem.
- illuminator83 9mo agoThere are lots of suboptimal solutions for lots of problems out there. I don't know why it would matter if the Linux Kernel does the same mistake. And I'm sure that wasn't the only solution. Just something somebody implemented and noone bothered to change it because it worked "well enough". But I wouldn't be surprised if this is known to cause the kind of issue GCs are known to cause such as race conditions, resource exhaustion and stalling. Let me do some quick research: https://gist.github.com/bobrik/82e5722261920c9f23d9402b88a0bb27 https://gist.github.com/bobrik/82e5722261920c9f23d9402b88a0b... https://nvd.nist.gov/vuln/detail/cve-2024-26923 https://nvd.nist.gov/vuln/detail/cve-2024-26923
- kannanvijayan 9mo agoWriting a GC in rust without just dropping the whole business into unsafe is really annoying. Jason Orendorff has an implementation of a GC in rust called "cell-gc" that seemed like only one I've seen so far that seemed to "get" how to marry rust to the requirements of a GC implementation: https://github.com/jorendorff/cell-gc https://github.com/jorendorff/cell-gc Still has a lot of unsafe code and macro helpers, but it's laid out well and documented pretty well. Not sure if you've run across it yet.
- yencabulator 9mo agoDid you notice the https://github.com/kyren/gc-arena https://github.com/kyren/gc-arena mentioned (via Lobsters)?