I was debugging a Rust service that had about 52 MB of live allocations but was sitting at 358 MB RSS.

I expected allocator fragmentation or retained pages. The actual cause was Transparent Huge Pages interacting with jemalloc and the allocation pattern of the workload.

Changing THP from always to madvise dropped RSS from 358 MB to 87 MB, with no application changes.

I wrote up the debugging process, including the allocator stats, smaps_rollup, and the THP setting that finally explained it:

https://certstream.dev/blog/jemalloc-transparent-huge-pages-rss.html