Called once by the process loader
| 534 | |
| 535 | // Called once by the process loader |
| 536 | static void mi_process_load(void) { |
| 537 | mi_heap_main_init(); |
| 538 | #if defined(MI_TLS_RECURSE_GUARD) |
| 539 | volatile mi_heap_t* dummy = _mi_heap_default; // access TLS to allocate it before setting tls_initialized to true; |
| 540 | MI_UNUSED(dummy); |
| 541 | #endif |
| 542 | os_preloading = false; |
| 543 | mi_assert_internal(_mi_is_main_thread()); |
| 544 | #if !(defined(_WIN32) && defined(MI_SHARED_LIB)) // use Dll process detach (see below) instead of atexit (issue #521) |
| 545 | atexit(&mi_process_done); |
| 546 | #endif |
| 547 | _mi_options_init(); |
| 548 | mi_process_setup_auto_thread_done(); |
| 549 | mi_process_init(); |
| 550 | if (mi_redirected) _mi_verbose_message("malloc is redirected.\n"); |
| 551 | |
| 552 | // show message from the redirector (if present) |
| 553 | const char* msg = NULL; |
| 554 | mi_allocator_init(&msg); |
| 555 | if (msg != NULL && (mi_option_is_enabled(mi_option_verbose) || mi_option_is_enabled(mi_option_show_errors))) { |
| 556 | _mi_fputs(NULL,NULL,NULL,msg); |
| 557 | } |
| 558 | |
| 559 | // reseed random |
| 560 | _mi_random_reinit_if_weak(&_mi_heap_main.random); |
| 561 | } |
| 562 | |
| 563 | #if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64)) |
| 564 | #include <intrin.h> |
no test coverage detected