jemalloc

Does the lg_prof_interval in jemalloc mean dump the heap between two time point?


opt.lg_prof_interval (ssize_t) r- [--enable-prof] Average interval (log base 2) between memory profile dumps, as measured in bytes of allocation activity. The actual interval between dumps may be sporadic because decentralized allocation counters are used to avoid synchronization bottlenecks. Profiles are dumped to files named according to the pattern ...i.heap, where is controlled by the opt.prof_prefix option. By default, interval-triggered profile dumping is disabled (encoded as -1).

The doc says.
And my option is export MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:17 (every 1GB samples a heap dump)

What I am confusing is the dump is the full dump between the time application started and now or just between the last dump.
enter image description here

I checked the size in dump found it's small.
So may be answer 2?
I find some profile articles but not mention it.

And for this how can I see memory decrease?(Does base work? I don't think so...)


Solution

  • Short answer is: (1) - the byte counters are from application start.

    Long answer: it is not necessary 'application start' event, but also can be mallctl("prof.reset") call from inside application.

    You can check this (quite old) thread for clarification (read all messages not just the one I've referenced): http://jemalloc.net/mailman/jemalloc-discuss/2015-November/001205.html

    "And for this how can I see memory decrease?(Does base work? I don't think so...)"

    Memory decrease you should see with --base option, in your case --base dump3. You will see negative numbers in jeprof report.