For example, I want to run the test with MALLOC_CONF="prof:true,prof_active:false"
, so I could just do
LD_PRELOAD=jemalloc-5.2.1/lib/libjemalloc.so.2 MALLOC_CONF="prof:true,prof_active:false" LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cargo test --package my_package --test my_mod test_jemalloc_prof
However, because cargo test itself does’t support jemalloc heap profiling, so we could get error messages like the following while compiling
<jemalloc>: Invalid conf pair: prof_active:false
<jemalloc>: Invalid conf pair: prof:true
My question is how to avoid this, and set MALLOC_CONF
only in running stage.