Implementing a safe garbage collector in Rust

Implementing a safe garbage collector in Rust.
In my last post I introduced an Emacs Lisp VM I was writing in Rust. My stated goal at the time was to complete a garbage collector. I think Rust has some really interesting properties that will make building garbage collectors easier and safer. Many of the techniques used in my GC are not original and have been developed by other Rustaceans in previous projects.
Why use garbage collection? virtually all non-trivial programs need some way to reuse memory.

Read in full here:

This thread was posted by one of our members via one of our news source trackers.

1 Like

Corresponding tweet for this thread:

Share link for this tweet.

2 Likes

Why use garbage collection?

virtually all non-trivial programs need some way to reuse memory. Rust does this by tracking every allocation statically to determine when it’s no longer in use.

Yet another person who has the incredibly wrong thought that Rust’s ownership is about managing memory, it’s not, it’s about managing all resources, of which a GC does nothing to help.

It’s slower

Obviously not benchmarked it, which others have, and it’s not slower compared to the alternatives proposed here.

For these reasons (and others) dynamic languages often use garbage collection (GC) to manage data.

No, they use it to manage memory, not to manage data, monstrous difference.


It is an interesting GC though, but it still suffers from the usual GC issues, which are solved by just using the ownership model.

2 Likes