ctl_refresh() is never called, je_mallctl("stats.allocated") doesn't work
Jason Evans
jasone at canonware.com
Thu Jan 8 14:50:58 PST 2015
On Dec 24, 2014, at 1:33 AM, Oran Agra <oran at redislabs.com> wrote:
> I'm trying to get the stat for total allocated memory.
>
> i'm calling either:
> size_t um;
> size_t sz = sizeof(size_t);
> res = je_mallctl("stats.allocated", &um, &sz, NULL, 0);
> or
> size_t allocated_mib[2];
> size_t allocated_mib_len = 0;
> allocated_mib_len = sizeof(allocated_mib);
> int res = je_mallctlnametomib("stats.allocated", allocated_mib, &allocated_mib_len);
> int res = je_mallctlbymib(allocated_mib, allocated_mib_len, &um, &sz, NULL, 0);
> both return success (0), but 'um' variable is always set to 0.
>
> digging into the source code of jemalloc, it seems that ctl_refresh() which is suppose to update this stat is never called.
> p.s. config_stats is set to true, and i confirmed that with a debugger.
>
> is it a bug? or am i missing something?
You need to call the "epoch" mallctl to refresh the stats:
http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#epoch <http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html#epoch>
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20150108/52bad7ff/attachment.html>
More information about the jemalloc-discuss
mailing list