Alignment of 8 is not required for additional header

malloc guarantees aligned memory. If we add an alignment here, we are adding
additonal unused 4 bytes. Each allocator has its own 4/8 byte header
(GGC / ARM have 4 bytes).

So if user request for 8 bytes of memory stats will add 8 + allocator 8.
However if we remove the alignment in stats header, allocator will consider
add 4 bytes to 12 byte request and zero padding.

It will be beneficial to leave the padding to allocator.
pull/8062/head
Deepika 2018-09-05 16:25:04 -05:00 committed by deepikabhavnani
parent c8734cf62a
commit 6646323867
1 changed files with 0 additions and 2 deletions

View File

@ -40,10 +40,8 @@ are active, the second one (MBED_MEM_TRACING_ENABLED) will trace the first one's
/* Implementation of the runtime max heap usage checker */
/******************************************************************************/
/* Size must be a multiple of 8 to keep alignment */
typedef struct {
uint32_t size;
uint32_t pad;
} alloc_info_t;
#ifdef MBED_HEAP_STATS_ENABLED