A Mark-and-Sweep Garbage Collector
Find a file
2024-08-24 17:34:21 -04:00
include Move all source and header files to subdirectories 2024-08-24 17:33:57 -04:00
src Move all source and header files to subdirectories 2024-08-24 17:33:57 -04:00
.gitignore Move all source and header files to subdirectories 2024-08-24 17:33:57 -04:00
LICENSE Added LICENSE 2024-08-20 22:17:24 -04:00
Makefile Rewrite Makefile for new directory structure 2024-08-24 17:34:21 -04:00
README.md README: fix block quote 2024-08-21 15:24:13 -04:00

marCsweep

A mark-and-sweep garbage collector with a simple virtual machine to perform allocations.

Building

Compiling the project should be relatively easy, even if you aren't familiar with make.

Dependencies: git, make, and gcc. Compiling with clang is also possible, simply replace "gcc" with "clang" in the first line of the Makefile.

git clone https://codeberg.org/andyscott/marCsweep.git

cd marCsweep

make release

That's it! The Makefile will automatically create the build directory and place the compiled executable there.

Running

Once compiled, the program can be run with the following:

cd build # or debug

./gc

By default the program will output the results of the test cases:

test_int_alloc: PASS
test_pair_alloc: PASS
test_obj_count: PASS
test_pair_alloc: PASS
test_unreachable: PASS
test_auto_gc: PASS

If all six tests pass, then the library compiles correctly on your system and should be ready for experimentation!

Notes

This is a personal project that I am writing in my free time to learn more about garbage collection. Thank you to Robert Nystrom for the idea.