Skip to content

Commit

Permalink
Don't reserve 36KiB of dynamic memory (it was mostly reserved for lib…
Browse files Browse the repository at this point in the history
…_deflate_reader)
  • Loading branch information
festlv committed Mar 14, 2022
1 parent 7ccb8bf commit 3dd3548
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ports/esp32/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3dd3548

Please sign in to comment.