diff --git a/src/ctl.c b/src/ctl.c index fd05c08b..206af4cc 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -3199,7 +3199,8 @@ label_return: * otherwise their values are undefined. * * This API is mainly intended for small class allocations, where extents are - * used as slab. + * used as slab. Note that if the bin the extent belongs to is completely + * full, "(a)" will be NULL. * * In case of large class allocations, "(a)" will be NULL, and "(e)" and "(f)" * will be zero (if stats are enabled; otherwise undefined). The other three diff --git a/src/extent.c b/src/extent.c index a015f9b3..4bb358d4 100644 --- a/src/extent.c +++ b/src/extent.c @@ -2124,7 +2124,12 @@ extent_util_stats_verbose_get(tsdn_t *tsdn, const void *ptr, } else { *bin_nfree = *bin_nregs = 0; } - *slabcur_addr = extent_addr_get(bin->slabcur); - assert(*slabcur_addr != NULL); + extent_t *slab; + if (bin->slabcur != NULL) { + slab = bin->slabcur; + } else { + slab = extent_heap_first(&bin->slabs_nonfull); + } + *slabcur_addr = slab != NULL ? extent_addr_get(slab) : NULL; malloc_mutex_unlock(tsdn, &bin->lock); } diff --git a/test/unit/extent_util.c b/test/unit/extent_util.c index 97e55f0f..4de0b043 100644 --- a/test/unit/extent_util.c +++ b/test/unit/extent_util.c @@ -94,10 +94,8 @@ TEST_BEGIN(test_query) { "Extent region count exceeded size"); assert_zu_ne(NREGS_READ(out), 0, "Extent region count must be positive"); - assert_ptr_not_null(SLABCUR_READ(out), - "Current slab is null"); - assert_true(NFREE_READ(out) == 0 - || SLABCUR_READ(out) <= p, + assert_true(NFREE_READ(out) == 0 || (SLABCUR_READ(out) + != NULL && SLABCUR_READ(out) <= p), "Allocation should follow first fit principle"); if (config_stats) { assert_zu_le(BIN_NFREE_READ(out),