mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 23:19:31 +03:00
initialize mimalloc options at process load
This commit is contained in:
parent
7ce9c02fd4
commit
2c19388bcf
3 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,7 @@ void _mi_error_message(const char* fmt, ...);
|
||||||
void _mi_warning_message(const char* fmt, ...);
|
void _mi_warning_message(const char* fmt, ...);
|
||||||
void _mi_verbose_message(const char* fmt, ...);
|
void _mi_verbose_message(const char* fmt, ...);
|
||||||
void _mi_trace_message(const char* fmt, ...);
|
void _mi_trace_message(const char* fmt, ...);
|
||||||
|
void _mi_options_init(void);
|
||||||
|
|
||||||
// "init.c"
|
// "init.c"
|
||||||
extern mi_stats_t _mi_stats_main;
|
extern mi_stats_t _mi_stats_main;
|
||||||
|
|
|
@ -416,6 +416,7 @@ static void mi_allocator_done() {
|
||||||
static void mi_process_load(void) {
|
static void mi_process_load(void) {
|
||||||
os_preloading = false;
|
os_preloading = false;
|
||||||
atexit(&mi_process_done);
|
atexit(&mi_process_done);
|
||||||
|
_mi_options_init();
|
||||||
mi_process_init();
|
mi_process_init();
|
||||||
//mi_stats_reset();
|
//mi_stats_reset();
|
||||||
if (mi_redirected) _mi_verbose_message("malloc is redirected.\n");
|
if (mi_redirected) _mi_verbose_message("malloc is redirected.\n");
|
||||||
|
|
|
@ -73,6 +73,13 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
|
|
||||||
static void mi_option_init(mi_option_desc_t* desc);
|
static void mi_option_init(mi_option_desc_t* desc);
|
||||||
|
|
||||||
|
void _mi_options_init(void) {
|
||||||
|
// called on process load
|
||||||
|
for(int i = 0; i < _mi_option_last; i++ ) {
|
||||||
|
mi_option_get((mi_option_t)i); // initialize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long mi_option_get(mi_option_t option) {
|
long mi_option_get(mi_option_t option) {
|
||||||
mi_assert(option >= 0 && option < _mi_option_last);
|
mi_assert(option >= 0 && option < _mi_option_last);
|
||||||
mi_option_desc_t* desc = &options[option];
|
mi_option_desc_t* desc = &options[option];
|
||||||
|
|
Loading…
Add table
Reference in a new issue