mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-27 13:33:18 +08:00
set pages to noaccess explicitly for valgrind precision
This commit is contained in:
parent
6e11a054a4
commit
b48040e20a
@ -66,7 +66,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||
|
||||
// Encoded free lists allow detection of corrupted free lists
|
||||
// and can detect buffer overflows, modify after free, and double `free`s.
|
||||
#if (MI_SECURE>=3 || MI_DEBUG>=1 || MI_PADDING > 0) && !MI_VALGRIND
|
||||
#if (MI_SECURE>=3 || MI_DEBUG>=1)
|
||||
#define MI_ENCODE_FREELIST 1
|
||||
#endif
|
||||
|
||||
|
@ -39,10 +39,11 @@ extern inline void* _mi_page_malloc(mi_heap_t* heap, mi_page_t* page, size_t siz
|
||||
mi_assert_internal(page->free == NULL || _mi_ptr_page(page->free) == page);
|
||||
|
||||
// allow use of the block internally
|
||||
// todo: can we optimize this call away for non-zero'd release mode?
|
||||
// note: when tracking we need to avoid ever touching the MI_PADDING since
|
||||
// that is tracked by valgrind etc. as non-accessible (through the red-zone, see `mimalloc-track.h`)
|
||||
#if MI_TRACK_ENABLED
|
||||
const size_t track_bsize = mi_page_block_size(page);
|
||||
mi_assert_internal(track_bsize >= size);
|
||||
mi_assert_internal(track_bsize >= size && track_bsize >= MI_PADDING_SIZE);
|
||||
mi_track_mem_undefined(block,track_bsize - MI_PADDING_SIZE);
|
||||
#endif
|
||||
|
||||
|
@ -616,7 +616,9 @@ static void mi_page_init(mi_heap_t* heap, mi_page_t* page, size_t block_size, mi
|
||||
// set fields
|
||||
mi_page_set_heap(page, heap);
|
||||
size_t page_size;
|
||||
_mi_segment_page_start(segment, page, block_size, &page_size, NULL);
|
||||
const void* page_start = _mi_segment_page_start(segment, page, block_size, &page_size, NULL);
|
||||
MI_UNUSED(page_start);
|
||||
mi_track_mem_noaccess(page_start,page_size);
|
||||
page->xblock_size = (block_size < MI_HUGE_BLOCK_SIZE ? (uint32_t)block_size : MI_HUGE_BLOCK_SIZE);
|
||||
mi_assert_internal(page_size / block_size < (1L<<16));
|
||||
page->reserved = (uint16_t)(page_size / block_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user