mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
reserve huge OS pages earlier on at process_init
This commit is contained in:
parent
af746ca4c1
commit
867d78f877
1 changed files with 9 additions and 9 deletions
10
src/init.c
10
src/init.c
|
@ -440,11 +440,6 @@ static void mi_process_load(void) {
|
||||||
if (msg != NULL && (mi_option_is_enabled(mi_option_verbose) || mi_option_is_enabled(mi_option_show_errors))) {
|
if (msg != NULL && (mi_option_is_enabled(mi_option_verbose) || mi_option_is_enabled(mi_option_show_errors))) {
|
||||||
_mi_fputs(NULL,NULL,msg);
|
_mi_fputs(NULL,NULL,msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi_option_is_enabled(mi_option_reserve_huge_os_pages)) {
|
|
||||||
size_t pages = mi_option_get(mi_option_reserve_huge_os_pages);
|
|
||||||
mi_reserve_huge_os_pages_interleave(pages, pages*500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the process; called by thread_init or the process loader
|
// Initialize the process; called by thread_init or the process loader
|
||||||
|
@ -471,6 +466,11 @@ void mi_process_init(void) mi_attr_noexcept {
|
||||||
#endif
|
#endif
|
||||||
mi_thread_init();
|
mi_thread_init();
|
||||||
mi_stats_reset(); // only call stat reset *after* thread init (or the heap tld == NULL)
|
mi_stats_reset(); // only call stat reset *after* thread init (or the heap tld == NULL)
|
||||||
|
|
||||||
|
if (mi_option_is_enabled(mi_option_reserve_huge_os_pages)) {
|
||||||
|
size_t pages = mi_option_get(mi_option_reserve_huge_os_pages);
|
||||||
|
mi_reserve_huge_os_pages_interleave(pages, pages*500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the process is done (through `at_exit`)
|
// Called when the process is done (through `at_exit`)
|
||||||
|
|
Loading…
Add table
Reference in a new issue