mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-10 13:28:41 +03:00
Add mi_alloc_init_t to indicate whether memory should be zero-filled or unitialized.
The latter means "fill with MI_DEBUG_UNINIT" in debug mode.
This commit is contained in:
parent
5a7685de0e
commit
7cd7224e3e
4 changed files with 34 additions and 29 deletions
|
@ -138,8 +138,8 @@ mi_msecs_t _mi_clock_start(void);
|
|||
|
||||
// "alloc.c"
|
||||
void* _mi_page_malloc(mi_heap_t* heap, mi_page_t* page, size_t size) mi_attr_noexcept; // called from `_mi_malloc_generic`
|
||||
void* _mi_heap_malloc_zero(mi_heap_t* heap, size_t size, bool zero);
|
||||
void* _mi_heap_realloc_zero(mi_heap_t* heap, void* p, size_t newsize, bool zero);
|
||||
void* _mi_heap_malloc_zero(mi_heap_t* heap, size_t size, mi_alloc_init_t init);
|
||||
void* _mi_heap_realloc_zero(mi_heap_t* heap, void* p, size_t newsize, mi_alloc_init_t init);
|
||||
mi_block_t* _mi_page_ptr_unalign(const mi_segment_t* segment, const mi_page_t* page, const void* p);
|
||||
bool _mi_free_delayed_block(mi_block_t* block);
|
||||
void _mi_block_zero_init(const mi_page_t* page, void* p, size_t size);
|
||||
|
|
|
@ -167,6 +167,11 @@ typedef int32_t mi_ssize_t;
|
|||
// Used as a special value to encode block sizes in 32 bits.
|
||||
#define MI_HUGE_BLOCK_SIZE ((uint32_t)MI_HUGE_OBJ_SIZE_MAX)
|
||||
|
||||
typedef enum mi_alloc_init_e {
|
||||
MI_ALLOC_UNINIT = 0, // uninitialized memory (debug mode: fill with MI_DEBUG_UNINIT)
|
||||
MI_ALLOC_ZERO_INIT = 1 // zero-initialize memory
|
||||
} mi_alloc_init_t;
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Mimalloc pages contain allocated blocks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue