I use jemalloc for memory allocation, a lot of threads allocate small or large objects concurrently, and I monitor two large object(64K, 128K) and find that: every 2 or 3 seconds, an 64K or 128K allocation takes about more than 300us. How to fix this problem.
Asked
Active
Viewed 200 times
0
-
2Random guess: (since you're not giving us any other information) Does this stall coincide with a call to `mmap` or `sbrk`? – Botje Sep 02 '21 at 11:56
-
You can additionally compare jemalloc with alternatives, such as glibc, tcmalloc, tbbmalloc. At least to find out whether the problem is jemalloc-related. – Daniel Langr Sep 02 '21 at 12:07
-
Generally, if deallocations are performed by the same threads as corresponding allocations, thread-local memory pools may help. Here is an article about the whole problem, however, it requires subscription: https://doi.org/10.1109/TPDS.2019.2960514. – Daniel Langr Sep 02 '21 at 12:10
-
An object pool may help the unnecessary deallocation and reallocatoin. – prehistoricpenguin Sep 03 '21 at 02:12
-
thanks for your help, I find a solution to write my own allocator for fix big size, it is much better than the default jemalloc. – yuandaxing Sep 07 '21 at 07:34