Skip to content

mark sweep and stop and copy garbage collectors implemented in rust

License

Notifications You must be signed in to change notification settings

SpicyRicecaker/gc-representation-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garbage Collection Representation in Rust

This program demonstrates two examples of garbage collection algorithms in Rust: sliding mark-compact and cheney style stop-and-copy (aka mark-copy).

The abstraction is that instead of messing with raw memory, we use pre-allocated arrays to represent memory, and we put structs on that struct that each have references to parent and children.

We make a graph-like data structure and do hundreds / thousands of add remove operations, record cpu and memory usage, and of course, the time that it takes to complete the program.

Running

Clone the git repo first

git clone https://github.com/SpicyRicecaker/gc-representation-rs.git --depth=1

Linux

On linux, this project uses the mold linker to compile its code. Did you know mold uses a concurrent mark-sweep garbage collection algorithm to remove files that aren't referenced?

Install the dependencies for your distro

Then clone and compile

git clone https://github.com/rui314/mold.git --depth=1
cd mold
git checkout v1.0.1
make -j$(nproc)
sudo make install

Windows

Now just Just cargo run lol

cargo run

About

mark sweep and stop and copy garbage collectors implemented in rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published