brew install jemalloc
❯ find /usr -iname "*jemalloc*"
find: /usr/sbin/authserver: Permission denied
/usr/local/bin/jemalloc-config
/usr/local/bin/jemalloc.sh
/usr/local/include/jemalloc
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jemalloc.rb
/usr/local/var/homebrew/linked/jemalloc
/usr/local/lib/pkgconfig/jemalloc.pc
/usr/local/lib/libjemalloc.a
/usr/local/lib/libjemalloc.2.dylib
/usr/local/lib/libjemalloc_pic.a
/usr/local/lib/libjemalloc.dylib
/usr/local/opt/jemalloc
find: /usr/local/mysql-8.0.19-macos10.15-x86_64/keyring: Permission denied
find: /usr/local/mysql-8.0.19-macos10.15-x86_64/data: Permission denied
/usr/local/Cellar/jemalloc
/usr/local/Cellar/jemalloc/5.3.0/bin/jemalloc-config
/usr/local/Cellar/jemalloc/5.3.0/bin/jemalloc.sh
/usr/local/Cellar/jemalloc/5.3.0/.brew/jemalloc.rb
/usr/local/Cellar/jemalloc/5.3.0/include/jemalloc
/usr/local/Cellar/jemalloc/5.3.0/include/jemalloc/jemalloc.h
/usr/local/Cellar/jemalloc/5.3.0/lib/pkgconfig/jemalloc.pc
/usr/local/Cellar/jemalloc/5.3.0/lib/libjemalloc.a
/usr/local/Cellar/jemalloc/5.3.0/lib/libjemalloc.2.dylib
/usr/local/Cellar/jemalloc/5.3.0/lib/libjemalloc_pic.a
/usr/local/Cellar/jemalloc/5.3.0/lib/libjemalloc.dylib
/usr/local/Cellar/jemalloc/5.3.0/share/man/man3/jemalloc.3
/usr/local/Cellar/jemalloc/5.3.0/share/doc/jemalloc
/usr/local/Cellar/jemalloc/5.3.0/share/doc/jemalloc/jemalloc.html
/usr/local/share/man/man3/jemalloc.3
/usr/local/share/doc/jemalloc
cd /usr/local/opt/jemalloc/bin
./jemalloc.sh
export DYLD_INSERT_LIBRARIES=/usr/local/lib/libjemalloc.2.dylib
to check if it applied.
MALLOC_CONF=stats_print:true ruby -e "exit"
If you can see the result, it has been succefully applied.
___ Begin jemalloc statistics ___
Version: "5.3.0-0-g54eaed1d8b56b1aa528be3bdd1877e59c56fa90c"
Build-time option settings
config.cache_oblivious: true
config.debug: false
config.fill: true
config.lazy_lock: false
config.malloc_conf: ""
config.opt_safety_checks: false
config.prof: false
config.prof_libgcc: false
config.prof_libunwind: false
config.stats: true
config.utrace: false
config.xmalloc: false
Run-time option settings
opt.abort: false
opt.abort_conf: false
opt.cache_oblivious: true
opt.confirm_conf: false
opt.retain: false
opt.dss: "secondary"
opt.narenas: 64
opt.percpu_arena: "disabled"
opt.oversize_threshold: 8388608
opt.hpa: false
opt.hpa_slab_max_alloc: 65536
opt.hpa_hugification_threshold: 1992294
opt.hpa_hugify_delay_ms: 10000
opt.hpa_min_purge_interval_ms: 5000
opt.hpa_dirty_mult: "0.25"
opt.hpa_sec_nshards: 4
opt.hpa_sec_max_alloc: 32768
opt.hpa_sec_max_bytes: 262144
opt.hpa_sec_bytes_after_flush: 131072
opt.hpa_sec_batch_fill_extra: 0
opt.metadata_thp: "disabled"
opt.mutex_max_spin: 600
opt.dirty_decay_ms: 10000 (arenas.dirty_decay_ms: 10000)
opt.muzzy_decay_ms: 0 (arenas.muzzy_decay_ms: 0)
opt.lg_extent_max_active_fit: 6
opt.junk: "false"
opt.zero: false
opt.experimental_infallible_new: false
opt.tcache: true
opt.tcache_max: 32768
opt.tcache_nslots_small_min: 20
opt.tcache_nslots_small_max: 200
opt.tcache_nslots_large: 20
opt.lg_tcache_nslots_mul: 1
opt.tcache_gc_incr_bytes: 65536
opt.tcache_gc_delay_bytes: 0
opt.lg_tcache_flush_small_div: 1
opt.lg_tcache_flush_large_div: 1
opt.thp: "not supported"
opt.stats_print: true
opt.stats_print_opts: ""
opt.stats_print: true
opt.stats_print_opts: ""
opt.stats_interval: -1
opt.stats_interval_opts: ""
opt.zero_realloc: "alloc"
Arenas: 65
Quantum size: 16
Page size: 4096
Maximum thread-cached size class: 32768
Number of bin size classes: 36
Number of thread-cache bin size classes: 41
Number of large size classes: 196
Allocated: 38207720, active: 38789120, metadata: 4989376 (n_thp 0), resident: 44253184, mapped: 47742976, retained: 0
Count of realloc(non-null-ptr, 0) calls: 0
Background threads: 0, num_runs: 0, run_interval: 0 ns
...