Try to merge tail with next block when splitting

When splitting a memory block, check if the next block is free.
If it is, then just extend it upwards instead of creating a new block.
This fixes a bug where when shrinking existing allocations would result in irreversible free space fragmentation.

When testing on the host, test all the poisoning configurations.
This commit is contained in:
Deomid Ryabkov
2018-03-22 14:58:20 +00:00
committed by Angus Gratton
parent 393f3da37c
commit 4b7eb1792e
6 changed files with 221 additions and 79 deletions

View File

@@ -14,8 +14,8 @@
#pragma once
#ifdef ESP_PLATFORM
#include "sdkconfig.h"
#endif
/* Configuration macros for multi-heap */
@@ -27,11 +27,3 @@
#define MULTI_HEAP_POISONING
#define MULTI_HEAP_POISONING_SLOW
#endif
#else /* !ESP_PLATFORM */
/* Host-side tests, enable full poisoning */
#define MULTI_HEAP_POISONING
#define MULTI_HEAP_POISONING_SLOW
#endif