All Projects → zesterer → Broom

zesterer / Broom

An ergonomic tracing garbage collector that supports mark 'n sweep garbage collection

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Broom

Sralloc
Memory allocators
Stars: ✭ 25 (-87.68%)
Mutual labels:  memory-management
Mesh
A memory allocator that automatically reduces the memory footprint of C/C++ applications.
Stars: ✭ 1,243 (+512.32%)
Mutual labels:  memory-management
Heapinspector For Ios
Find memory issues & leaks in your iOS app without instruments
Stars: ✭ 1,819 (+796.06%)
Mutual labels:  memory-management
Errand Boy
A memory-conscious alternative to os.fork() and subprocess.Popen().
Stars: ✭ 34 (-83.25%)
Mutual labels:  memory-management
Vulkanmemoryallocator
Easy to integrate Vulkan memory allocation library
Stars: ✭ 1,136 (+459.61%)
Mutual labels:  memory-management
Isoalloc
A general purpose memory allocator that implements an isolation security strategy to mitigate memory safety issues while maintaining good performance
Stars: ✭ 130 (-35.96%)
Mutual labels:  memory-management
Redis Memory Analyzer
Redis memory profiler to find the RAM bottlenecks throw scaning key space in real time and aggregate RAM usage statistic by patterns.
Stars: ✭ 591 (+191.13%)
Mutual labels:  memory-management
Blog
Our open source benchmarks and code samples
Stars: ✭ 162 (-20.2%)
Mutual labels:  memory-management
Automem
C++-style automatic memory management smart pointers for D
Stars: ✭ 71 (-65.02%)
Mutual labels:  memory-management
Avoid Memory Leak Android
🔥 Examples of memory leaks and common patterns that cause them in Android development and how to fix/avoid them
Stars: ✭ 140 (-31.03%)
Mutual labels:  memory-management
Go Pmem
Native persistent memory support for Go
Stars: ✭ 57 (-71.92%)
Mutual labels:  memory-management
Weakable Self
A Swift micro-framework to easily deal with weak references to self inside closures
Stars: ✭ 64 (-68.47%)
Mutual labels:  memory-management
Memorypool
一个极简内存池实现
Stars: ✭ 131 (-35.47%)
Mutual labels:  memory-management
Gc
Simple, zero-dependency garbage collection for C
Stars: ✭ 851 (+319.21%)
Mutual labels:  memory-management
Umpire
An application-focused API for memory management on NUMA & GPU architectures
Stars: ✭ 154 (-24.14%)
Mutual labels:  memory-management
Articles Translator
📚Translate the distinct technical blogs. Please star or watch. Welcome to join me.
Stars: ✭ 606 (+198.52%)
Mutual labels:  memory-management
Ipyexperiments
jupyter/ipython experiment containers for GPU and general RAM re-use
Stars: ✭ 128 (-36.95%)
Mutual labels:  memory-management
Ugc
A single-header incremental garbage collector library
Stars: ✭ 173 (-14.78%)
Mutual labels:  memory-management
Rmm
RAPIDS Memory Manager
Stars: ✭ 154 (-24.14%)
Mutual labels:  memory-management
Bdwgc
The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (libgc, bdwgc, boehm-gc)
Stars: ✭ 1,855 (+813.79%)
Mutual labels:  memory-management

Broom

An ergonomic tracing garbage collector that supports mark 'n sweep garbage collection.

Cargo Documentation License

Features

  • Ergonomic API
  • Mark and sweep heap cleaning
  • Easy (and safe) mutation of heap values, despite cycles
  • Zero-cost access to heap objects through handles

Example

use broom::prelude::*;

// The type you want the heap to contain
pub enum Object {
    Num(f64),
    List(Vec<Handle<Self>>),
}

// Tell the garbage collector how to explore a graph of this object
impl Trace<Self> for Object {
    fn trace(&self, tracer: &mut Tracer<Self>) {
        match self {
            Object::Num(_) => {},
            Object::List(objects) => objects.trace(tracer),
        }
    }
}

// Create a new heap
let mut heap = Heap::default();

// Temporary objects are cheaper than rooted objects, but don't survive heap cleans
let a = heap.insert_temp(Object::Num(42.0));
let b = heap.insert_temp(Object::Num(1337.0));

// Turn the numbers into a rooted list
let c = heap.insert(Object::List(vec![a, b]));

// Change one of the numbers - this is safe, even if the object is self-referential!
*heap.get_mut(a).unwrap() = Object::Num(256.0);

// Create another number object
let d = heap.insert_temp(Object::Num(0.0));

// Clean up unused heap objects
heap.clean();

// a, b and c are all kept alive because c is rooted and a and b are its children
assert!(heap.contains(a));
assert!(heap.contains(b));
assert!(heap.contains(c));

// Because `d` was temporary and unused, it did not survive the heap clean
assert!(!heap.contains(d));

Who this crate is for

  • People writing dynamically-typed languages in Rust that want a simple, reliable garbage collector
  • People that want to have complex graph data structures with mutation and cycles but who don't want memory leaks

Who this crate is not for

  • People that want garbage collection when writing ordinary Rust code

Performance

This crate makes no specific promises about performance. It is designed with a 'best attempt' approach; this means that it should be fast enough for most purposes but is probably not competitive with garbage collectors that have had years of development work ploughed into them.

TODO

There are a few things I want to do with broom if I get the time:

  • Smarter cleanup strategies than mark 'n sweep
  • Partial cleans to prevent garbage collection lag spikes

If you're interested in working on any of these things, feel free to open a pull request!

License

Broom is licensed under either of:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].