Error Triage Hub (9)
Missing jemalloc Causing glibc Arena Memory Retention
Without LD_PRELOAD=libjemalloc.so.2, glibc ptmalloc2 fragments Python Synapse heap arenas and holds 40-60% dead RAM permanently.
Heap Bloat: +40-65% RSS retention | Env: LD_PRELOAD libjemalloc
Why glibc ptmalloc2 Never Shrinks Synapse RSS After Bursts
Synapse continuously allocates and evicts short-lived JSON event dictionaries and LRU cache slices. Under default Linux glibc malloc, fragmented free chunks sit pinned below the heap top or inside per-thread arenas, leaving resident RSS high long after a room sync storm finishes.
Verifying jemalloc Mapping Inside the Running Process
Execute grep jemalloc /proc/$(pgrep -f synapse.app.homeserver)/maps on the host or inside the container. If the command returns empty output, your Synapse process is running on glibc malloc and leaking usable headroom back to OOM.
Measured Thresholds & Configuration
| Allocator Configuration | Post-Sync Steady RSS | Heap Fragmentation |
|---|---|---|
| Default glibc malloc | 2.3 - 3.6 GB | High (40-65% unreturned) |
| LD_PRELOAD libjemalloc.so.2 | 1.2 - 1.9 GB | Low (pages released quickly) |
| Continuwuity Rust (jemalloc/mimalloc) | 110 - 240 MB | Minimal static binary footprint |