mimalloc 2.0.9: 5-Way Allocator Test and 200-Relay Deployment

By 1AEO Team • January 2026

Experiment: 100 relays (5 groups × 20) on Debian 13.2 with Tor 0.4.8.x

We tested 5 memory allocators with Debian 13.2 on 100 Tor relays to find the best option for long-running Guard relays. The result: mimalloc 2.0.9 used 7.4× less memory than mimalloc 3.0.1. We then migrated all 200 relays on the server to the winner.

Experiment Design

GroupAllocatorRelaysTest PeriodDuration
Amimalloc 3.0.120Dec 31 – Jan 1010 days
Bmimalloc 2.0.920Jan 2 – Jan 108 days
Cmimalloc 2.1.720Jan 2 – Jan 108 days
Djemalloc 5.3.020Jan 4 – Jan 106 days
Eglibc 2.4120Jan 2 – Jan 108 days

All 5 groups ran simultaneously from Jan 4–10 (6 days). Each group had 20 relays with identical hardware and Tor configuration.

Results (Jan 10, 2026)

AllocatorAvg Memoryvs mimalloc 3.0.1
mimalloc 2.0.91.41 GB7.4× less
mimalloc 2.1.71.83 GB5.7× less
jemalloc 5.3.02.74 GB3.8× less
glibc 2.414.15 GB2.5× less
mimalloc 3.0.110.44 GB
5-Way Allocator Comparison Chart

mimalloc 3.0.1 Regression

mimalloc 3.0.1 showed unbounded memory growth over 10 days:

DayMemory
1~1.9 GB
5~5.3 GB
1010.44 GB

Memory continued growing at ~1 GB/day with no sign of stabilizing. In contrast, mimalloc 2.0.9 stabilized at ~1.4 GB by day 3 and remained flat.

Observation

We don't know why mimalloc 3.0.1 behaves this way. The data shows memory growth; we haven't investigated the root cause in mimalloc's code.

Production Migration

Based on these results, we migrated all 200 relays to mimalloc 2.0.9:

# Build mimalloc 2.0.9 from source (Debian 13 ships 3.0.1)
wget https://github.com/microsoft/mimalloc/archive/refs/tags/v2.0.9.tar.gz
tar xzf v2.0.9.tar.gz && cd mimalloc-2.0.9
mkdir build && cd build && cmake .. && make
sudo mkdir -p /usr/local/lib/mimalloc
sudo cp libmimalloc.so.2.0 /usr/local/lib/mimalloc/libmimalloc-2.0.9.so

# Configure systemd override for each relay
for relay in $(ls /var/lib/tor-instances/); do
    sudo mkdir -p /etc/systemd/system/tor@${relay}.service.d/
    cat <<EOF | sudo tee /etc/systemd/system/tor@${relay}.service.d/allocator.conf
[Service]
Environment="LD_PRELOAD=/usr/local/lib/mimalloc/libmimalloc-2.0.9.so"
EOF
done
sudo systemctl daemon-reload
Debian 13 Warning: The libmimalloc2.0 package ships mimalloc 3.0.1—the version with the regression. Build 2.0.9 from source instead.

Summary

RecommendationAllocatorMemory
Bestmimalloc 2.0.91.41 GB
Goodmimalloc 2.1.71.83 GB
Acceptablejemalloc 5.3.02.74 GB
Avoidmimalloc 3.0.110.44 GB

📊 Data: experiments/2026-01-08-5way-allocator-comparison

Join the Mission