bounds on execution time for various jemalloc APIs
jasone at canonware.com
Thu Nov 14 12:58:07 PST 2013
On Nov 14, 2013, at 11:58 AM, Rich Prohaska <prohaska7 at gmail.com> wrote:
> Does jemalloc provide bounds on execution time for malloc, free, etc?
> I suspect that free sometimes takes a long time to execute. What is a good way to measure the time to execute it? Does jemalloc already have methods to measure this, or do I add this to my application?
jemalloc does not, and can not, provide hard bounds on execution time, because it relies on system calls that in turn provide no bounds, namely mmap(2), madvise(2), and munmap(2). In practice, the biggest cause of variation is that calls to free(3) can trigger numerous madvise() calls (in order to purge unused dirty pages). If your application is sensitive to timing variation, you may find the "opt.lg_dirty_mult" mallctl of use (e.g. set MALLOC_CONF=lg_dirty_mult:-1 in the environment prior to application launch).
jemalloc does not collect timing statistics, so you'll need to either use a CPU profiler or add timers directly to your code.
More information about the jemalloc-discuss