#2850·jemalloc

How to trace the fragmentation?

Author: ChrisZcuCreated May 20, 2025Updated May 22, 2025

If there anyway to trace the fragmentation? In my application, only 8GB memory used (we record each malloc/free to count the total memory not released), but the process totally used 58GB memory (from RSS) and the "stats.mapped" shows totally 58GB. We think it may be caused by jemalloc cache, but how to trace the fragmentation source? Which memory using pattern causes this problem maybe?