We currently round up allocation sizes to 16-bytes on 32 and 64-bit.
When recursively calling alloc() after the allocation of a new heap chunk,
make sure to adjust the requested size parameter again to its original value,
to ensure 16 byte alignment.
Change-Id: Ie8cd29d60639bf43023a310b7be6f772305fa826
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
willAllocate(size);
#endif // DETAILED_MM_STATS
- size += align(sizeof(MMInfo));
+ const std::size_t alignedSizeOfMMInfo = align(sizeof(MMInfo));
+ size += alignedSizeOfMMInfo;
assert(size >= 16);
assert(size % 16 == 0);
m_d->fallbackObject->info.markBit = 0;
m_d->fallbackObject->info.size = allocSize;
}
- return alloc(size - sizeof(MMInfo));
+ return alloc(size - alignedSizeOfMMInfo);
}
MMObject *m = it.value();