From acf462fb61aa0a45a75769fca8c1691ed0e1ec73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Moskal?= Date: Wed, 17 Jul 2019 06:23:13 -0700 Subject: [PATCH] Decrease size of GC heap to allow more DAL allocs (#2246) --- libs/core/codal.cpp | 4 ++-- libs/core/pxtcore.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libs/core/codal.cpp b/libs/core/codal.cpp index 1c4b4894..13a0f156 100644 --- a/libs/core/codal.cpp +++ b/libs/core/codal.cpp @@ -28,8 +28,8 @@ MicroBitEvent lastEvent; void platform_init() { microbit_seed_random(); seedRandom(microbit_random(0x7fffffff)); - if (device_heap_size(1)) - gcPreAllocateBlock(device_heap_size(1) - 4); + if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4) + gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION); } void platform_init(); diff --git a/libs/core/pxtcore.h b/libs/core/pxtcore.h index abd5d0b8..154171da 100644 --- a/libs/core/pxtcore.h +++ b/libs/core/pxtcore.h @@ -16,11 +16,8 @@ void debuglog(const char *format, ...); #define GC_MAX_ALLOC_SIZE 9000 -#if CONFIG_ENABLED(MICROBIT_BLE_ENABLED) #define GC_BLOCK_SIZE 256 -#else -#define GC_BLOCK_SIZE 1000 -#endif +#define NON_GC_HEAP_RESERVATION 1024 #define DMESG NOLOG