#2824·jemalloc

如何微调大型内存请求的设置,这些请求通常大于 8MB

作者: 13015517713创建于 2025年4月3日更新于 2026年9月2日

env: linux 5.4 x86_64, jemalloc version 5.3 I'm having some performance issues and would like some advice. My programs would frequently request memory with large size. They were universally larger than 15MB. By using perf, I found a lot of overhead in page faults. I wrote a simple program to test this, a single thread to loop through memory requests and memset. Like that: while(true){ void* p = malloc(g_size); memset(p, 0, g_size); free(p); } I found that when g_size=7MB there is no page fault and the qps is about 5000, then when I request 7.1MB the qps drops to 600 with a lot of page faults as described above. In the issue I learnt that the oversize_threshold could have an effect on this, so I set the oversize_threshold to 16MB. the results didn't change.

内容来源: jemalloc/jemalloc