Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 1.07 KB

File metadata and controls

49 lines (42 loc) · 1.07 KB

The Simple Allocator

This is an implementation of the memory allocator discussed in the Crafting Memory Allocators blog post.

The build and benchmarks were tested on macOS.

Release build

cmake -B build-release -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -flto" .
make -C build-release

Debug build

cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-O0 -g3" .
make -C build-debug

Benchmarks

  • std::deque<T>
build-release/benchmark-deque
  • std::list<T>
build-release/benchmark-list
  • std::list<T> with long std::string
build-release/benchmark-list-huge-element
  • std::map<K, V>
build-release/benchmark-map
  • std::unordered_map<K, V>
build-release/benchmark-unordered-map
  • std::vector<V>
build-release/benchmark-vector

Replacing the default system malloc

DYLD_INSERT_LIBRARIES=./build-release/libmalloc_replacement.dylib DYLD_FORCE_FLAT_NAMESPACE=1 <command>