diff --git a/components/heap/third_party/dartino/cmpctmalloc.c b/components/heap/third_party/dartino/cmpctmalloc.c index 132c9015cc64..1e12f05e5630 100644 --- a/components/heap/third_party/dartino/cmpctmalloc.c +++ b/components/heap/third_party/dartino/cmpctmalloc.c @@ -1353,7 +1353,7 @@ IRAM_ATTR void *cmpct_aligned_alloc_impl(cmpct_heap_t *heap, size_t size, size_t // The page allocator already has the ability to return allocations that // are more aligned than the page size. - if (alignment >= PAGE_SIZE / 2) { + if (alignment >= PAGE_SIZE / 2 || size >= PAGE_SIZE / 4 * 3) { // We take 2k (half-page) allocations in here too, because treating them as // page allocations will waste 2k, but putting them in the normal system // actually wastes even more.