File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,9 @@ static void disjoint_pool_print_stats(disjoint_pool_t *pool) {
492492
493493 for (size_t i = 0 ; i < pool -> buckets_num ; i ++ ) {
494494 bucket_t * bucket = pool -> buckets [i ];
495+ // lock bucket before accessing its stats
496+ utils_mutex_lock (& bucket -> bucket_lock );
497+
495498 if (bucket -> alloc_count ) {
496499 LOG_DEBUG ("%14zu %12zu %12zu %18zu %20zu %21zu" , bucket -> size ,
497500 bucket -> alloc_count , bucket -> free_count ,
@@ -500,8 +503,11 @@ static void disjoint_pool_print_stats(disjoint_pool_t *pool) {
500503 high_bucket_size =
501504 utils_max (bucket_slab_alloc_size (bucket ), high_bucket_size );
502505 }
506+
503507 high_peak_slabs_in_use =
504508 utils_max (bucket -> max_slabs_in_use , high_peak_slabs_in_use );
509+
510+ utils_mutex_unlock (& bucket -> bucket_lock );
505511 }
506512
507513 LOG_DEBUG ("current pool size: %zu" ,
You can’t perform that action at this time.
0 commit comments