|
|
|
|
|
by pastaguy1
1298 days ago
|
|
Would there be any value in a GC'd language where you had the option to explicitly call do_gc_now()? Is this functionality already out there and just not popular? I haven't spent a ton of time in these languages, so forgive the naivety. Again, naively, this seems like it would be a good compromise between what GC offers but near-determinism when you want it. I guess Rust and C++ also "pause the world", it's just predictable when it happens. It seems kind of arbitrary in some ways, like maybe I don't want the "world pause" at the end of this scope. There are ways around it obviously, but you start language-wrestling at that point. |
|
Rust does not ship a garbage collector with your binary, so there is nothing to pause your code.
When the compiler adds those drop() statements, they just free the respective memory at runtime. There is no need to pause your application to do that.
The garbage collector needs to pause the application because it takes time to calculate in runtime which parts of the application memory are safe to clean. If the application was running in the meantime, there's no guarantee that the blocks it marked as "safe" are actually still so.