Ad

mimalloc: High-performance general-purpose memory allocator

mimalloc is a compact, fast, and secure memory allocator designed for various platforms. It offers excellent performance characteristics and is suitable for high-performance computing and resource-constrained environments.
Screenshot of microsoft/mimalloc homepage

mimalloc is a general-purpose memory allocator initially developed for the Koka and Lean languages. It aims to provide high performance with a small and consistent design. mimalloc employs free list sharding and multi-sharding techniques to reduce fragmentation and improve locality. It's designed as a drop-in replacement for malloc and offers various features such as secure mode, first-class heaps, and bounded worst-case allocation times.

  • Small Size: mimalloc is a relatively small library (around 10k LOC) making it easy to integrate into various projects.

  • Free List Sharding: Reduces fragmentation by dividing the free list into smaller, more manageable lists.

  • Multi-Sharding: Further enhances performance by using multiple free lists per mimalloc page, enabling parallel freeing and reducing contention.

  • Secure Mode: Offers features like guard pages and randomized allocation to mitigate heap vulnerabilities.

  • First-Class Heaps: Enables the creation and management of multiple independent heaps, allowing for better resource isolation and control.

  • Core Functionality: Provides standard allocation and deallocation functions (e.g., malloc, free) with improved performance.

  • Platform Support: Supports a wide range of platforms including Linux, Windows, macOS, WASM, and various BSD systems.

  • Configuration: Offers extensive configuration options including secure mode, heap management, and thread-local segments.

  • Performance: Outperforms other leading allocators like jemalloc, tcmalloc, and Hoard in many benchmarks.

  • Memory Management: Implements bounded worst-case allocation times and minimal internal fragmentation.

mimalloc has been actively developed for several years with a stable release history and ongoing maintenance. Version 3 is the primary focus, with v1 and v2 maintained for bug fixes and security improvements. The project has a growing community and a comprehensive documentation set. Recent commits focus on performance improvements, bug fixes, and the addition of new features, demonstrating continued development effort.

mimalloc benefits developers requiring a high-performance, secure, and well-supported memory allocator. It is well-suited for applications demanding efficient memory management, such as large-scale distributed services, runtime systems, and embedded systems. It offers advantages over standard malloc in terms of speed, fragmentation reduction, and security features.

Summarize:
Share:
Stars
13,154
Forks
1,133
Issues
383
Created
7 years ago
Commit
29 days ago
License
MIT
Archived
No
Updated 16 days ago

Similar Repositories