How manishcooks/grab works
Grab is a small C++ allocator and multithreaded allocation benchmark. A user supplies a thread count; the benchmark starts and joins workers, each of which performs 100,000 allocations through its thread-local allocator. The allocator rounds small requests into size classes, reuses freed blocks, and obtains its pool with mmap. The README also describes a global-lock baseline, but the sampled runtime shows the thread-local design; no baseline implementation is present in the tree. Edges reflect the excerpts and README, not unsampled code.
Main entry points: grab.hpp Thread-local allocator · main.cpp Benchmark driver
Components 7
Benchmark
- Benchmark driver
main.cpp - Allocation worker
main.cpp
Allocator
- Thread-local allocator
grab.hpp - Segregated free lists
grab.hpp - Mapped memory pool
grab.hpp
Other components
- User
- Operating system
Connections 6
- User → Benchmark driver: sets thread count
main.cpp - Benchmark driver → Allocation worker: starts and joins
main.cpp - Allocation worker → Thread-local allocator: allocates 16 bytes
main.cpp - Thread-local allocator → Segregated free lists: reuses blocks
grab.hpp - Thread-local allocator → Mapped memory pool: bumps allocation
grab.hpp - Thread-local allocator → Operating system: maps and unmaps
grab.hpp