Relationship between opt.prof and opt.prof_leak

Jason Evans jasone at canonware.com
Fri Nov 6 12:45:28 PST 2015


On Nov 6, 2015, at 9:50 AM, Evan Jones <ejones at twitter.com> wrote:
> Jemalloc's profiling and leak debugging features are super useful, and I've used them multiple times to figure out Java native memory leak issues. However, I realized I'm not actually sure how the opt.prof and opt.prof_leak options relate. I *think* they work like the following, but I didn't find the docs super clear, and I only looked at the code for about 10 minutes. I'm happy to submit a patch to the docs to try and clarify this, once I understand it completely:
> 
> 
> * There is only one type of dump. It contains both "allocated" counts and "in use" counts (or free counts which can be used to calculate in use).

The two types of stats are:
- Current bytes/objects, aka "inuse" in pprof/jeprof terminology.  These are counts of how many sampled objects currently exist.  Use these stats to understand current memory usage.
- Cumulative bytes/objects, aka "alloc" in pprof/jeprof terminology.  These are counts of how many sampled bytes/objects have existed since the most recent stats reset (process start or "prof.reset" mallctl call).  Use these stats to understand total allocation volume.

> * By default, jeprof will show you the *in use* counts. However, it can show you the *allocated* counts instead with --alloc_space or --alloc_objects.

Correct.

> * By default, dumps are "incremental": They contain the objects allocated since the last dump. If you want dumps that contain everything since the process was started, enable opt.prof_accum.

No, dumps are always based on the most recent stats reset (process start or "prof.reset" mallctl call).  You can view incremental differences between two dumps by using the --base option to jeprof.

Jason


More information about the jemalloc-discuss mailing list