diff options
author | David T. Goldblatt <davidtgoldblatt@gmail.com> | 2017-10-02 01:02:39 (GMT) |
---|---|---|
committer | David Goldblatt <davidtgoldblatt@gmail.com> | 2017-12-19 00:29:10 (GMT) |
commit | a8dd8876fb483f402833fa05f0fb46fe7c5416e1 (patch) | |
tree | bd6dfde1ad99f87157e07e56c721ae3911ab4dbb /src/bin.c | |
parent | 4bf4a1c4ea418ba490d35d23aee0f535e96ddd23 (diff) | |
download | jemalloc-a8dd8876fb483f402833fa05f0fb46fe7c5416e1.zip jemalloc-a8dd8876fb483f402833fa05f0fb46fe7c5416e1.tar.gz jemalloc-a8dd8876fb483f402833fa05f0fb46fe7c5416e1.tar.bz2 |
Move bin initialization from arena module to bin module.
Diffstat (limited to 'src/bin.c')
-rw-r--r-- | src/bin.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include "jemalloc/internal/jemalloc_internal_includes.h" #include "jemalloc/internal/bin.h" +#include "jemalloc/internal/witness.h" const bin_info_t bin_infos[NBINS] = { #define BIN_INFO_bin_yes(reg_size, slab_size, nregs) \ @@ -18,4 +19,17 @@ const bin_info_t bin_infos[NBINS] = { #undef SC }; - +bool +bin_init(bin_t *bin) { + if (malloc_mutex_init(&bin->lock, "arena_bin", WITNESS_RANK_BIN, + malloc_mutex_rank_exclusive)) { + return true; + } + bin->slabcur = NULL; + extent_heap_new(&bin->slabs_nonfull); + extent_list_init(&bin->slabs_full); + if (config_stats) { + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); + } + return false; +} |