mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
Merge branch 'dev' into dev-slice
This commit is contained in:
commit
06ee1d7949
2 changed files with 3 additions and 11 deletions
|
@ -418,9 +418,9 @@ static inline malloc_zone_t* mi_get_default_zone(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
__attribute__((constructor(0)))
|
__attribute__((constructor(101))) // highest priority
|
||||||
#else
|
#else
|
||||||
__attribute__((constructor)) // seems not supported by g++-11 on the M1
|
__attribute__((constructor)) // priority level is not supported by gcc
|
||||||
#endif
|
#endif
|
||||||
__attribute__((used))
|
__attribute__((used))
|
||||||
static void _mi_macos_override_malloc(void) {
|
static void _mi_macos_override_malloc(void) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
}
|
}
|
||||||
#elif defined(__cplusplus)
|
#elif defined(__cplusplus)
|
||||||
// C++: use static initialization to detect process start/end
|
// C++: use static initialization to detect process start/end
|
||||||
|
// This is not guaranteed to be first/last but the best we can generally do?
|
||||||
struct mi_init_done_t {
|
struct mi_init_done_t {
|
||||||
mi_init_done_t() {
|
mi_init_done_t() {
|
||||||
_mi_process_load();
|
_mi_process_load();
|
||||||
|
@ -55,15 +56,6 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static mi_init_done_t mi_init_done;
|
static mi_init_done_t mi_init_done;
|
||||||
/*
|
|
||||||
extern mi_heap_t _mi_heap_main;
|
|
||||||
static bool mi_process_attach(void) {
|
|
||||||
_mi_process_load();
|
|
||||||
atexit(&_mi_process_done);
|
|
||||||
return (_mi_heap_main.thread_id != 0);
|
|
||||||
}
|
|
||||||
static bool mi_initialized = mi_process_attach();
|
|
||||||
*/
|
|
||||||
#else
|
#else
|
||||||
#pragma message("define a way to call _mi_process_load/done on your platform")
|
#pragma message("define a way to call _mi_process_load/done on your platform")
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue