mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
Optimize: mark the padding bytes no access
mark the padding bytes and mi_padding_t struct no access for all kinds of pages to improve asan accuracy(issue #1043)
This commit is contained in:
parent
fae61ed946
commit
a81f754b1b
1 changed files with 10 additions and 0 deletions
10
src/page.c
10
src/page.c
|
@ -1016,6 +1016,16 @@ void* _mi_malloc_generic(mi_heap_t* heap, size_t size, bool zero, size_t huge_al
|
||||||
p = _mi_page_malloc_zero(heap, page, size, zero);
|
p = _mi_page_malloc_zero(heap, page, size, zero);
|
||||||
mi_assert_internal(p != NULL);
|
mi_assert_internal(p != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MI_PADDING
|
||||||
|
mi_padding_t* const padding = (mi_padding_t*)((uint8_t*)p + mi_page_usable_block_size(page));
|
||||||
|
size_t delta = padding->delta;
|
||||||
|
|
||||||
|
uint8_t* fill = (uint8_t*)padding - delta;
|
||||||
|
const size_t maxpad = (delta > MI_MAX_ALIGN_SIZE ? MI_MAX_ALIGN_SIZE : delta);
|
||||||
|
mi_track_mem_noaccess(fill, maxpad + MI_PADDING_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
// move singleton pages to the full queue
|
// move singleton pages to the full queue
|
||||||
if (page->reserved == page->used) {
|
if (page->reserved == page->used) {
|
||||||
mi_page_to_full(page, mi_page_queue_of(page));
|
mi_page_to_full(page, mi_page_queue_of(page));
|
||||||
|
|
Loading…
Add table
Reference in a new issue