It is recommended to set MALLOC_CONF
before running a certain program.
However, I does not always have access to how the program is started.
So I found the --with-jemalloc-prefix
option in jemalloc’s document. Seems that we could pre-define the configuration when building the program.
However, I don’w how this could cowork with cmake. For example, the following will cause a definition of macro of --with-jemalloc-prefix
target_compile_definitions (jemalloc PRIVATE --with-jemalloc-prefix="prof:true,prof_active:true,lg_prof_interval:10")