Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Guide

Comparing dynamic memory performance: malloc/free vs jemalloc vs mimalloc in C++ [StackOverflow Architecture Guide]

profiler_pat
Performance Hunter
MEMBER
担当者: 146
参加日: Aug 2019
投稿: 33
ありがとう: 31
1 か月前 · Jul 5, 2026 9:21 AM
#1

Why replacing standard glibc malloc with Microsoft's mimalloc or jemalloc yields a 15-30% speedup in multi-threaded C++ applications:

  • Thread-Local Heaps: mimalloc allocates pages per-thread, completely eliminating global heap mutex contention.
  • Page-Level Free Lists: Sub-allocation within 64KB pages minimizes memory fragmentation.
  • Drop-in replacement: Link with -lmimalloc or preload via LD_PRELOAD=/usr/lib/libmimalloc.so with zero code changes!

Benchmarked on high-concurrency HTTP parser: throughput increased by 26.4%!

memory_model_mook
Low-Level C Veteran
MEMBER
担当者: 163
参加日: Jan 2019
投稿: 11
ありがとう: 33
1 か月前 · Jul 5, 2026 2:39 PM
#2

We switched our game server clusters to mimalloc last year. Memory footprint stabilized and allocator lock contention vanished completely.

dotnet_runtime_architect
.NET Core Specialist
MEMBER
担当者: 103
参加日: Apr 2018
投稿: 40
ありがとう: 24
1 か月前 · Jul 6, 2026 5:10 AM
#3

The huge page (THP) support in mimalloc also reduces TLB misses on large heap sizes.