Hi,
After fixing issue #888 you have changed default allocator provider at chmemheap.c (chheap.c):
@@ -106,7 +106,7 @@ static memory_heap_t default_heap; */ void _heap_init(void) { - default_heap.provider = chCoreAllocAligned; + default_heap.provider = chCoreAllocAlignedWithOffset;
Since then (I suppose) heap memory became more fragmented due to this code:
void *chHeapAllocAligned(memory_heap_t *heapp, size_t size, unsigned align) ... /* More memory is required, tries to get it from the associated provider else fails.*/ if (heapp->provider != NULL) { ahp = heapp->provider((pages + 1U) * CH_HEAP_ALIGNMENT, align, sizeof (heap_header_t));
As far as I understand +1U is not needed here, it means the size of a heap_header_t added to the size of allocated block (as it was before #888 fix when chCoreAllocAligned was used here). But now it's redundant because same is passed as 3rd argument (sizeof(heap_header_t)).
Please check it out.
Thanks!
Hi,
Thanks for finding, fixed in repository for all active branches.
Giovanni