mirror of https://github.com/microsoft/mimalloc
add extra assertions to check that blocks are always aligned to MI_MAX_ALIGN_SIZE
This commit is contained in:
parent
03020fbf81
commit
b7dd5d6564
|
@ -40,6 +40,7 @@ extern inline void* _mi_page_malloc_zero(mi_heap_t* heap, mi_page_t* page, size_
|
|||
page->free = mi_block_next(page, block);
|
||||
page->used++;
|
||||
mi_assert_internal(page->free == NULL || _mi_ptr_page(page->free) == page);
|
||||
mi_assert_internal(_mi_is_aligned(block, MI_MAX_ALIGN_SIZE));
|
||||
#if MI_DEBUG>3
|
||||
if (page->free_is_zero) {
|
||||
mi_assert_expensive(mi_mem_is_zero(block+1,size - sizeof(*block)));
|
||||
|
|
|
@ -436,6 +436,8 @@ uint8_t* _mi_segment_page_start(const mi_segment_t* segment, const mi_page_t* pa
|
|||
mi_assert_internal((uintptr_t)p % block_size == 0);
|
||||
}
|
||||
}
|
||||
mi_assert_internal(_mi_is_aligned(p, MI_MAX_ALIGN_SIZE));
|
||||
mi_assert_internal(block_size > MI_MAX_ALIGN_GUARANTEE || _mi_is_aligned(p,block_size));
|
||||
|
||||
if (page_size != NULL) *page_size = psize;
|
||||
mi_assert_internal(_mi_ptr_page(p) == page);
|
||||
|
|
Loading…
Reference in New Issue