From 63b0c39343487392f8a5a29baa0a78d869833554 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 27 Aug 2018 05:16:47 -0400 Subject: [PATCH] reorder size_class struct for better performance --- malloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/malloc.c b/malloc.c index becab38..2b19fd3 100644 --- a/malloc.c +++ b/malloc.c @@ -181,14 +181,14 @@ static size_t get_slab_size(size_t slots, size_t size) { } static struct size_class { + pthread_mutex_t mutex; void *class_region_start; - size_t metadata_allocated; - size_t metadata_count; + struct slab_metadata *slab_info; struct slab_metadata *partial_slabs; struct slab_metadata *free_slabs; - struct slab_metadata *slab_info; - pthread_mutex_t mutex; struct random_state rng; + size_t metadata_allocated; + size_t metadata_count; } size_class_metadata[N_SIZE_CLASSES]; static const size_t class_region_size = 128ULL * 1024 * 1024 * 1024;