MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_heap_main_init

Function mi_heap_main_init

3rd/mimalloc-2.0.9/src/init.c:167–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167static void mi_heap_main_init(void) {
168 if (_mi_heap_main.cookie == 0) {
169 _mi_heap_main.thread_id = _mi_thread_id();
170 _mi_heap_main.cookie = 1;
171 #if defined(_WIN32) && !defined(MI_SHARED_LIB)
172 _mi_random_init_weak(&_mi_heap_main.random); // prevent allocation failure during bcrypt dll initialization with static linking
173 #else
174 _mi_random_init(&_mi_heap_main.random);
175 #endif
176 _mi_heap_main.cookie = _mi_heap_random_next(&_mi_heap_main);
177 _mi_heap_main.keys[0] = _mi_heap_random_next(&_mi_heap_main);
178 _mi_heap_main.keys[1] = _mi_heap_random_next(&_mi_heap_main);
179 }
180}
181
182mi_heap_t* _mi_heap_main_get(void) {
183 mi_heap_main_init();

Callers 4

_mi_heap_main_getFunction · 0.85
_mi_heap_initFunction · 0.85
mi_process_loadFunction · 0.85
mi_process_initFunction · 0.85

Calls 4

_mi_thread_idFunction · 0.85
_mi_random_init_weakFunction · 0.85
_mi_random_initFunction · 0.85
_mi_heap_random_nextFunction · 0.85

Tested by

no test coverage detected