Developer knowledge network · moderated exchange

UnreliableCode 커뮤니티

개발자 연구, 리버스 엔지니어링 및 코딩 커뮤니티

Knowledge index살다
4Categories
919Threads
2.8K게시물
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.