From 3dd35485b5864e2804c425f0887af93eeaeded16 Mon Sep 17 00:00:00 2001 From: Reinis Veips Date: Mon, 14 Mar 2022 23:38:05 +0200 Subject: [PATCH] Don't reserve 36KiB of dynamic memory (it was mostly reserved for lib_deflate_reader) --- ports/esp32/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/esp32/main.c b/ports/esp32/main.c index 66d772ddc121..75143ab2a0b5 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -142,11 +142,15 @@ void mp_task(void *pvParameter) { } #else // Allocate the uPy heap using malloc and get the largest available region - size_t mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT) - 36*1024; + size_t mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT); void *mp_task_heap = malloc(mp_task_heap_size); #endif + multi_heap_info_t info; soft_reset: + heap_caps_get_info(&info, MALLOC_CAP_8BIT); + printf("C heap: total=%d, free=%d, allocd=%d, mpy heap=%d bytes\n", info.total_free_bytes + info.total_allocated_bytes, + info.total_free_bytes, info.total_allocated_bytes, mp_task_heap_size); // initialise the stack pointer for the main thread mp_stack_set_top((void *)sp); mp_stack_set_limit(MP_TASK_STACK_SIZE - MP_TASK_STACK_LIMIT_MARGIN);