Tiny Garbage Collector for C is implemented in roughly 500 lines of code. It uses a conservative, thread-local mark-and-sweep strategy to reclaim unreachable allocations automatically. Memory allocated through its API can still be manually released when deterministic cleanup is required. Developers can register destructors that run immediately before managed objects are freed. Garbage collection normally runs after allocation thresholds are reached, but it can also be triggered, paused, or resumed manually. Special root allocations can be preserved even when they are not reachable through the usual stack or managed-memory rules. Its small codebase makes tgc useful for embedded experiments, language runtimes, and learning how garbage collectors work.

Features

  • Thread-local memory management
  • Automatic unreachable allocation cleanup
  • Manual collection and freeing
  • Conservative mark-and-sweep collection
  • Registered destructors
  • Persistent root allocations

Project Samples

Project Activity

See All Activity >

Categories

File Managers

License

MIT License

Follow Tiny Garbage Collector

Tiny Garbage Collector Web Site

Other Useful Business Software
$300 Free Credits to Build on Google Cloud Icon
$300 Free Credits to Build on Google Cloud

New customers can spin up VMs, build with AI, and query data at no cost.

Put your $300 in credit toward real workloads, then keep building with free monthly usage for 20+ products. No commitment and no charge until you upgrade.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Tiny Garbage Collector!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

C

Related Categories

C File Managers

Registered

8 hours ago