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
Ship Agents Faster Icon
Ship Agents Faster

Transform your applications and workflows into powerful agentic systems at global scale.

Gemini Enterprise Agent Platform lets you rapidly build, scale, govern and optimize production-ready agents grounded in your organization's data. The platform enables developers to build custom or pre-built agents for virtually any use case. New customers get $300 in free credits.
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

2 days ago