From 8bfa1a7dd50ec8ffb80ae64309cedf27f86ad583 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 1 May 2021 22:10:20 -0400 Subject: [PATCH] use 1 slot for all extended size classes This reduces memory usage and improves security in combination with the guard slab feature. --- README.md | 8 ++++---- h_malloc.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3c5dcef..2cc5db2 100644 --- a/README.md +++ b/README.md @@ -589,10 +589,10 @@ retaining the isolation. | size class | worst case internal fragmentation | slab slots | slab size | internal fragmentation for slabs | | - | - | - | - | - | -| 20480 | 20.0% | 2 | 40960 | 0.0% | -| 24576 | 16.66% | 2 | 49152 | 0.0% | -| 28672 | 14.28% | 2 | 57344 | 0.0% | -| 32768 | 12.5% | 2 | 65536 | 0.0% | +| 20480 | 20.0% | 1 | 20480 | 0.0% | +| 24576 | 16.66% | 1 | 24576 | 0.0% | +| 28672 | 14.28% | 1 | 28672 | 0.0% | +| 32768 | 12.5% | 1 | 32768 | 0.0% | | 40960 | 20.0% | 1 | 40960 | 0.0% | | 49152 | 16.66% | 1 | 49152 | 0.0% | | 57344 | 14.28% | 1 | 57344 | 0.0% | diff --git a/h_malloc.c b/h_malloc.c index 4b7552d..7d2477d 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -144,7 +144,7 @@ static const u16 size_class_slots[] = { /* 1024 */ 8, 8, 8, 8, /* 2048 */ 6, 5, 4, 4, #if CONFIG_EXTENDED_SIZE_CLASSES - /* 4096 */ 2, 2, 2, 2, + /* 4096 */ 1, 1, 1, 1, /* 8192 */ 1, 1, 1, 1, /* 16384 */ 1, 1, 1, 1, #endif