diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 155f01a..97b0171 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -1068,13 +1068,13 @@ namespace snmalloc SNMALLOC_ASSUME(size <= SLAB_SIZE); sizeclass_t sizeclass = size_to_sizeclass(size); - stats().sizeclass_alloc(sizeclass); assert(sizeclass < NUM_SMALL_CLASSES); auto& fl = small_fast_free_lists[sizeclass]; void* head = fl.value; if (likely(head != nullptr)) { + stats().sizeclass_alloc(sizeclass); // Read the next slot from the memory that's about to be allocated. fl.value = Metaslab::follow_next(head); @@ -1097,6 +1097,9 @@ namespace snmalloc return reinterpret_cast(replacement) ->template small_alloc_slow(sizeclass); } + + stats().sizeclass_alloc(sizeclass); + handle_message_queue(); size_t rsize = sizeclass_to_size(sizeclass); auto& sl = small_classes[sizeclass];