Skip to content
mark/sweep garbage collector for C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

oscar, for when memory leaks are making you grouchy.

oscar provides a mark and sweep garbage collector for a pool of equally-sized chunks of memory. It uses lazy sweeping, roughly as described here. The pool can be grown an demand, or kept inside a fixed-size pool of statically allocated memory. Marking and freeing behavior are specified via callbacks.

The GC should be reasonably efficient (though it is not generational). Its tests pass on OS X and OpenBSD, and it runs without Valgrind warnings.

The documentation is inside oscar.h. For usage examples, see the test suite (test.c).

For more information about garbage collectors, I recommend Paul R. Wilson's "Uniprocessor Garbage Collection Techniques", Jones, Hosking, and Moss's The Garbage Collection Handbook, and Jones & Lins' Garbage Collection: Algorithms for Automatic Dynamic Memory Management.

You can’t perform that action at this time.