summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan Leijen <daan@microsoft.com>2022-04-19 20:16:49 -0700
committerDaan Leijen <daan@microsoft.com>2022-04-19 20:16:49 -0700
commitd9f6ab58c5310a2972e626b0c180228fa7f0322e (patch)
treee82e9b2688d34f57ef864b7214bd3a687a6202a2
parentf76a678c049c8b45ada4990dac28e180ed3f2274 (diff)
comments
-rw-r--r--src/alloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index ab7a5b9..3023594 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -37,9 +37,9 @@ extern inline void* _mi_page_malloc(mi_heap_t* heap, mi_page_t* page, size_t siz
page->free = mi_block_next(page, block);
mi_assert_internal(page->free == NULL || _mi_ptr_page(page->free) == page);
- // zero the block?
+ // zero the block? note: we need to zero the full block size (issue #63)
if mi_unlikely(zero) {
- mi_assert_internal(page->xblock_size != 0); // do not call with zero'ing for huge blocks
+ mi_assert_internal(page->xblock_size != 0); // do not call with zero'ing for huge blocks (see _mi_malloc_generic)
const size_t zsize = (page->is_zero ? sizeof(block->next) : page->xblock_size);
_mi_memzero_aligned(block, zsize);
}