mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
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:

committed by
Angus Gratton

parent
393f3da37c
commit
4b7eb1792e
@@ -244,6 +244,8 @@ void *multi_heap_realloc(multi_heap_handle_t heap, void *p, size_t size)
|
||||
place.)
|
||||
|
||||
For now we just malloc a new buffer, copy, and free. :|
|
||||
|
||||
Note: If this ever changes, multi_heap defrag realloc test should be enabled.
|
||||
*/
|
||||
size_t orig_alloc_size = head->alloc_size;
|
||||
|
||||
|
Reference in New Issue
Block a user