# bdwgc/bdwgc

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/bdwgc-bdwgc).**

3,418 stars · 432 forks · C · other

## Links

- GitHub: https://github.com/bdwgc/bdwgc
- Homepage: https://www.hboehm.info/gc/
- awesome-repositories: https://awesome-repositories.com/repository/bdwgc-bdwgc.md

## Topics

`c` `c-plus-plus` `cplusplus` `cpp` `cross-platform` `garbage-collection` `garbage-collector` `gc` `leak-detection` `library` `memory-allocation` `memory-leak-detection` `memory-management` `portable`

## Description

This project is a garbage collection library and memory allocator for C and C++ that provides automatic reclamation of unreachable objects. It functions as a memory management system that can replace standard allocation functions to automate memory reclamation without requiring source modification.

The system is distinguished by its ability to perform incremental and generational garbage collection to reduce application pauses, as well as parallel collection to distribute tracing across multiple CPU cores. It includes a specialized string manipulation library that uses shared structures to enable zero-copy substring extraction and constant-time concatenation for large text blocks.

The toolkit further covers heap analysis and observability, including memory leak detection, buffer overflow reporting, and heap retention tracing. It provides integration for standard library containers, support for multithreaded synchronization through thread-local allocation buffers, and mechanisms for topological object finalization.

The library includes cross-platform portability support to handle memory alignment and data segment boundaries across different operating systems.

## Tags

### Operating Systems & Systems Programming

- [Memory Allocation Libraries](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/memory-allocation-libraries.md) — Provides a conservative garbage collection library that replaces standard system memory allocators via library preloading. ([source](https://www.hboehm.info/gc/simple_example.html))
- [Root Pointer Registration](https://awesome-repositories.com/f/operating-systems-systems-programming/dynamic-library-loading/root-pointer-registration.md) — Registers data sections of loaded libraries as root pointers to prevent the premature reclamation of global variables. ([source](https://www.hboehm.info/gc/porting.html))
- [Garbage Collection](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/automated-reclamation-systems/garbage-collection.md) — Provides a tracing garbage collector for C++ that automatically reclaims unreachable objects.
- [Parallel Garbage Collection](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/runtime-schedulers/work-stealing-schedulers/parallel-garbage-collection.md) — Distributes the mark phase across multiple processors using a work queue to reduce total collection time. ([source](https://www.hboehm.info/gc/scale.html))
- [Multithreaded Heap Synchronization](https://awesome-repositories.com/f/operating-systems-systems-programming/multithreaded-heap-synchronization.md) — Synchronizes heap access and traces active thread stacks using atomic operations to ensure multithreaded memory consistency. ([source](https://www.hboehm.info/gc/porting.html))
- [Incremental Page Tracking](https://awesome-repositories.com/f/operating-systems-systems-programming/paged-memory-management/incremental-page-tracking.md) — Uses incremental page tracking to reclaim memory in small steps and minimize application pause times.
- [Hybrid Memory Reclamation](https://awesome-repositories.com/f/operating-systems-systems-programming/hybrid-memory-reclamation.md) — Combines explicit deallocation of common objects with automatic collection to reduce the frequency of collection cycles. ([source](https://www.hboehm.info/gc/issues.html))
- [STL Managed Allocators](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/custom-memory-allocators/stl-managed-allocators.md) — Integrates C++ standard library containers with managed memory to automate the reclamation of element data.
- [External Library Memory Automation](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/memory-allocation-libraries/external-library-memory-automation.md) — Replaces standard allocation calls with managed allocations to eliminate leaks and premature frees in external libraries. ([source](https://www.hboehm.info/gc/gcinterface.html))
- [Parallel Tracing Distribution](https://awesome-repositories.com/f/operating-systems-systems-programming/symmetric-multiprocessing-mechanisms/parallel-workload-distribution/parallel-tracing-distribution.md) — Distributes the mark-phase tracing of object references across multiple CPU cores using a shared work queue.

### Programming Languages & Runtimes

- [Automatic Memory Management](https://awesome-repositories.com/f/programming-languages-runtimes/automatic-memory-management.md) — Provides automatic memory management for C and C++ to reclaim unused memory without manual deallocation.
- [Generational Garbage Collection](https://awesome-repositories.com/f/programming-languages-runtimes/automatic-memory-management/generational-garbage-collection.md) — Implements a generational garbage collection strategy to optimize reclamation by separating objects by age.
- [Conservative Garbage Collection](https://awesome-repositories.com/f/programming-languages-runtimes/conservative-garbage-collection.md) — Implements a conservative mark-and-sweep collector to identify reachable memory by scanning stacks and data segments.
- [Concatenation Optimizers](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-strings/concatenation-optimizers.md) — Joins multiple character sequences into a single shared structure to avoid expensive data copying. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Incremental Garbage Collection](https://awesome-repositories.com/f/programming-languages-runtimes/incremental-garbage-collection.md) — Implements an incremental garbage collector that uses page tracking to perform reclamation in small steps.
- [Allocator Local Caches](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/thread-local-storage/allocator-local-caches.md) — Maintains per-thread free lists for common object sizes to reduce global lock contention. ([source](https://www.hboehm.info/gc/gcdescr.html))
- [Large-Scale Text Handling](https://awesome-repositories.com/f/programming-languages-runtimes/large-scale-text-handling.md) — Uses specialized data structures to perform fast concatenation and substring operations on large blocks of text. ([source](https://www.hboehm.info/gc/))
- [STL Custom Allocators](https://awesome-repositories.com/f/programming-languages-runtimes/stl-custom-allocators.md) — Provides custom allocators for standard library containers to ensure elements are correctly traced and reclaimed. ([source](https://www.hboehm.info/gc/gcinterface.html))
- [C-Compatible String Conversions](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-strings/string-slices/c-compatible-string-conversions.md) — Transforms shared string structures into modifiable character arrays and wraps existing arrays into shared structures. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Finalizer Hooks](https://awesome-repositories.com/f/programming-languages-runtimes/finalizer-hooks.md) — Executes specific cleanup functions when an object is garbage collected to release non-memory system resources. ([source](https://www.hboehm.info/gc/))
- [Topological Finalization](https://awesome-repositories.com/f/programming-languages-runtimes/finalizer-hooks/topological-finalization.md) — Ensures objects are finalized in a specific order so that referring objects are cleaned up before the objects they point to. ([source](https://www.hboehm.info/gc/finalization.html))
- [Object Kind Hinting](https://awesome-repositories.com/f/programming-languages-runtimes/object-kind-hinting.md) — Categorizes allocations as pointer-free or immutable to optimize how the collector scans for references. ([source](https://www.hboehm.info/gc/gcdescr.html))
- [String Iterators](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/string-utilities/string-iterators.md) — Iterates over characters using custom functions or position markers to process text content sequentially. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Shared String Formatting](https://awesome-repositories.com/f/programming-languages-runtimes/shared-string-formatting.md) — Generates formatted text using a printf-style interface where both input and output are shared structures. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Shared String Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/shared-string-libraries.md) — Provides a specialized toolkit for handling large text blocks using shared structures and efficient concatenation.
- [Shared String Rebalancing](https://awesome-repositories.com/f/programming-languages-runtimes/shared-string-rebalancing.md) — Rebalances concatenated string structures to ensure fast character retrieval and substring operations. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Cord Representations](https://awesome-repositories.com/f/programming-languages-runtimes/string-representation-types/cord-representations.md) — Provides a cord-based string representation for constant-time concatenation and zero-copy substring extraction.

### Data & Databases

- [Heap Inspection Tools](https://awesome-repositories.com/f/data-databases/in-memory-databases/in-memory-state-stores/heap-inspection-tools.md) — Produces detailed dumps of free blocks and live object counts to diagnose fragmentation and leaks. ([source](https://www.hboehm.info/gc/debugging.html))
- [Concurrent Memory Allocation Synchronization](https://awesome-repositories.com/f/data-databases/shared-memory-buffers/concurrent-memory-allocation-synchronization.md) — Manages shared memory and allocation across multiple threads to prevent race conditions and reduce lock contention.

### Software Engineering & Architecture

- [Preloading Mechanisms](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/dynamic-library-loaders/preloading-mechanisms.md) — Intercepts standard system memory functions via dynamic linker preloading to enable automatic memory reclamation.
- [Zero-Copy Substring Extraction](https://awesome-repositories.com/f/software-engineering-architecture/string-processing-algorithms/substring-length-metrics/substring-extraction-methods/zero-copy-substring-extraction.md) — Creates new string references representing specific ranges from existing sequences without duplicating underlying data. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))
- [Pointer-Free Allocations](https://awesome-repositories.com/f/software-engineering-architecture/block-based-data-models/data-block-memory-management/contiguous-memory-buffers/manual-pointer-management/pointer-free-allocations.md) — Allocates blocks of memory guaranteed to contain no pointers, allowing the collector to skip scanning them. ([source](https://cdn.jsdelivr.net/gh/bdwgc/bdwgc@master/README.md))
- [Pointer-Free Memory Regions](https://awesome-repositories.com/f/software-engineering-architecture/block-based-data-models/data-block-memory-management/contiguous-memory-buffers/manual-pointer-management/pointer-memory-management/pointer-free-memory-regions.md) — Restricts specific memory pages to pointer-free objects to avoid memory leaks caused by near-miss pointer hits. ([source](https://www.hboehm.info/gc/gcdescr.html))
- [Lock-Free Memory Reclamation](https://awesome-repositories.com/f/software-engineering-architecture/producer-consumer-workflow-managers/lock-free-concurrent-queues/locking-optimizations/lock-striped-sharding/lock-free-read-paths/lock-free-memory-reclamation.md) — Reclaims memory automatically without explicit deallocation to enable lock-free read access in multithreaded environments. ([source](https://cdn.jsdelivr.net/gh/bdwgc/bdwgc@master/README.md))
- [Stack Trace Generation](https://awesome-repositories.com/f/software-engineering-architecture/stacks/stack-trace-formatters/stack-trace-generation.md) — Captures and prints the call stack associated with objects to provide diagnostic information for memory leak debugging. ([source](https://www.hboehm.info/gc/porting.html))
- [String Manipulators](https://awesome-repositories.com/f/software-engineering-architecture/string-manipulators.md) — Handles large volumes of text using shared structures to avoid expensive data copying and reallocation.
- [String Comparisons](https://awesome-repositories.com/f/software-engineering-architecture/string-matching-algorithms/string-comparisons.md) — Finds specific characters or substrings within a sequence and performs lexicographical comparisons. ([source](https://www.hboehm.info/gc/gc_source/cordh.txt))

### System Administration & Monitoring

- [Reference Chain Analysis](https://awesome-repositories.com/f/system-administration-monitoring/heap-memory-monitoring/reference-chain-analysis.md) — Identifies why memory is being retained by tracing reference chains from roots using sampling and backtraces. ([source](https://www.hboehm.info/gc/debugging.html))

### Testing & Quality Assurance

- [Memory Leak Detection](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/memory-leak-detection.md) — Identifies inaccessible objects that were not freed and reports the source file and line number to debug memory leaks. ([source](https://cdn.jsdelivr.net/gh/bdwgc/bdwgc@master/README.md))
- [False Pointer Detection](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/memory-leak-detection/pointer-leak-scanners/false-pointer-detection.md) — Reports values misidentified as pointers to resolve unexpected heap growth and memory leaks. ([source](https://www.hboehm.info/gc/debugging.html))

### Development Tools & Productivity

- [Heap Retention Analysis Tools](https://awesome-repositories.com/f/development-tools-productivity/heap-retention-analysis-tools.md) — Ships a diagnostic utility for tracing reference chains and generating stack traces to identify memory retention causes.

### Security & Cryptography

- [Buffer Overflow Defenses](https://awesome-repositories.com/f/security-cryptography/buffer-overflow-defenses.md) — Annotates objects with metadata to detect and report buffer overflows or memory corruption during the collection process. ([source](https://cdn.jsdelivr.net/gh/bdwgc/bdwgc@master/README.md))
