2025-09-07 05:16:23 -07:00
2025-09-07 05:16:23 -07:00
2025-08-28 04:59:23 -07:00
2025-09-07 05:16:23 -07:00
2025-08-28 04:59:23 -07:00
2025-08-28 04:59:23 -07:00
2025-09-06 04:29:50 -07:00

RefCount

RefCount is a reference counting (thus the name) and garbage collection library written in C.

RefCount has support for

  • breaking dependency chains via garbage collection
  • Multiple distinct contexts allowing the tracking of many types of objects, each with a possibly different memory allocation implementation
  • Safely running in multi-threaded environments

Building

The only external requirement is ht. If you build using the instructions below, CMake will automatically download and build the dependency for you.

For multi threading support, you need a C11 compiler that supports atomic types and has the <threads.h> header. Without threading support, you only need a C99 compiler.

You can build using:

cmake -B build .
# replace with above with
# cmake -B build -DREFCOUNT_USE_THREADS=OFF
# to build without threads (change the "OFF" to "ON" to re-enable threads)
make -C build

You can then run tests using:

make -C build test

Documentation

You can generate documentation with:

doxygen

You can look in the test/ directory for some examples of the various features of RefCount in use.

Description
C reference counting and garbage collection library.
Readme GPL-3.0 281 KiB
Languages
C 98%
CMake 2%