mimalloc Memory Allocator

mimalloc Memory Allocator

github.com

2

About this website

mimalloc is a free and open-source general-purpose memory allocator developed by Daan Leijen at Microsoft Research, first released in 2019. Designed as a drop-in replacement for the standard system allocators (malloc, glibc's ptmalloc, jemalloc, tcmalloc), mimalloc achieves excellent performance on both single-threaded and multi-threaded workloads, often outperforming its predecessors. Key features: performance: consistently outperforms jemalloc and tcmalloc on various benchmarks, with 7% improvement on benchmarks like redis, and up to 23% on multi-threaded benchmarks. Free-list sharding: the core innovation is sharding the free-lists into multiple categories per size class: (1) a small free-list for fast per-thread allocation, (2) a thread-local heap free-list, and (3) a global free-list. This reduces fragmentation and contention. Per-thread heaps: each thread gets its own heap, eliminating lock contention for most allocations. Heaps can be acquired and released (abandoned) for work-stealing across threads. First-fit reduction: mimalloc reduces first-fit allocation bias by using reduced internal contention and delayed merging, leading to better cache locality. Security: mimalloc provides guard pages, randomized allocation, and encrypted free-lists (optional) as defense-in-depth against heap exploitation. Deterministic: fully deterministic mode for reproducible allocation patterns in testing. Stats: built-in allocation statistics (heap size, allocation counts, fragmentation). Page-level management with mmap-based large page support. Debug mode: full checking of allocated objects (canary values, double-free detection, buffer overruns). Cross-platform: Linux, macOS, Windows, FreeBSD, NetBSD. Wide architecture support: x86-64, ARM64, RISC-V, WebAssembly. Used as the default allocator in Zig and Nim compilers. MIT.

Tags & Categories

Tags

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!