review is_zero flag

This commit is contained in:
daanx 2023-04-18 17:18:39 -07:00
parent b845be241a
commit 4d976270eb
6 changed files with 17 additions and 15 deletions

View file

@ -300,7 +300,7 @@ static inline uintptr_t _mi_divide_up(uintptr_t size, size_t divider) {
}
// Is memory zero initialized?
static inline bool mi_mem_is_zero(void* p, size_t size) {
static inline bool mi_mem_is_zero(const void* p, size_t size) {
for (size_t i = 0; i < size; i++) {
if (((uint8_t*)p)[i] != 0) return false;
}

View file

@ -285,7 +285,7 @@ typedef struct mi_page_s {
uint8_t segment_idx; // index in the segment `pages` array, `page == &segment->pages[page->segment_idx]`
uint8_t segment_in_use:1; // `true` if the segment allocated this page
uint8_t is_committed:1; // `true` if the page virtual memory is committed
uint8_t is_zero_init:1; // `true` if the page was zero initialized
uint8_t is_zero_init:1; // `true` if the page was initially zero initialized
// layout like this to optimize access in `mi_malloc` and `mi_free`
uint16_t capacity; // number of blocks committed, must be the first field, see `segment.c:page_clear`