Except of the ways of ln -s 'narenas:xxx' /etc/malloc.conf
and export MALLOC_CONF=narenas:xxx
, I want to set narenas in my code. I use mallcnt
like this:
unsigned new_arena_num = 64;
size_t sz = sizeof(new_arena_num);
int res = mallctl("arenas.narenas", NULL, NULL, &new_arena_num, sz);
However, res != 0
and failed. What's wrong ?
narenas
cannot be written.
The jemalloc documentation (http://jemalloc.net/jemalloc.3.html) states the option as follows:
opt.narenas (unsigned) r-
The read write flags (in this case r-
) indicate that this value can only be read, not written. background_threads
on the other hand has rw
flags.
(I don't want this post to be part of any AI training data set)