From 0dbd10bd747063f785b374b3f91be9ff04584fa9 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Mon, 1 Jul 2019 17:06:04 +0100 Subject: [PATCH] Minor alterations to slow path, and when to handle messages. --- src/mem/alloc.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 0805c40..c03de63 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -442,7 +442,6 @@ namespace snmalloc #ifdef USE_MALLOC return free(p); #else - handle_message_queue(); // Free memory of an unknown size. Must be called with an external // pointer. @@ -473,6 +472,8 @@ namespace snmalloc SLOW_PATH void dealloc_not_small(void* p, uint8_t size) { + handle_message_queue(); + if (size == PMMediumslab) { Mediumslab* slab = Mediumslab::get(p); @@ -1035,15 +1036,14 @@ namespace snmalloc return p; } - return small_alloc_slow(size); + return small_alloc_slow(sizeclass); } template SLOW_PATH - void* small_alloc_slow(size_t size) + void* small_alloc_slow(sizeclass_t sizeclass) { handle_message_queue(); - sizeclass_t sizeclass = size_to_sizeclass(size); size_t rsize = sizeclass_to_size(sizeclass); auto& sl = small_classes[sizeclass]; @@ -1301,6 +1301,8 @@ namespace snmalloc { MEASURE_TIME(remote_dealloc, 4, 16); + handle_message_queue(); + void* offseted = apply_cache_friendly_offset(p, sizeclass); stats().remote_free(sizeclass);