I am trying to use jemalloc to do memory profiling.
I run my program with
prof:true,prof_active:false
and I use mallctl call to change prof.interval
to 1, and set prof.activate
to true. And I expect that the program could keep dumping *.heap file. However, no heap file is dumped.
After that, I re-run my program with the following. And after the program is started, it will use mallctl call to change prof.activate
to true. This time, the program could dump *.heap file regularly.
prof:true,prof_active:false,lg_prof_interval:18
If I set lg_prof_interval in MALLOC_CONF, then I can't control the rate at runtime. I actually wish that I could change the value of lg_prof_interval
through mallctl at runtime, however, I failed for now. I wonder why.
=== EDIT ===
I debug the mallctl call, seems it returns with 1
, with errno
set to "Resource temporarily unavailable".
I found prof.interval
is described as the following. And eventually I realized what r-
means. It is to say that prof.interval
is a readonly metric, so it is not going to be changed at runtime.
prof.interval (uint64_t) r- [--enable-prof]
Average number of bytes allocated between interval-based profile dumps. See the opt.lg_prof_interval option for additional information.