mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
macOS: anonymous page ID make it as env var.
This commit is contained in:
parent
2c19388bcf
commit
b72a2d9659
3 changed files with 6 additions and 2 deletions
|
@ -232,6 +232,7 @@ typedef enum mi_option_e {
|
||||||
mi_option_page_reset,
|
mi_option_page_reset,
|
||||||
mi_option_cache_reset,
|
mi_option_cache_reset,
|
||||||
mi_option_reset_decommits,
|
mi_option_reset_decommits,
|
||||||
|
mi_option_os_tag,
|
||||||
_mi_option_last
|
_mi_option_last
|
||||||
} mi_option_t;
|
} mi_option_t;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||||
{ 0, UNINIT, MI_OPTION(segment_cache) }, // cache N segments per thread
|
{ 0, UNINIT, MI_OPTION(segment_cache) }, // cache N segments per thread
|
||||||
{ 0, UNINIT, MI_OPTION(page_reset) },
|
{ 0, UNINIT, MI_OPTION(page_reset) },
|
||||||
{ 0, UNINIT, MI_OPTION(cache_reset) },
|
{ 0, UNINIT, MI_OPTION(cache_reset) },
|
||||||
{ 0, UNINIT, MI_OPTION(reset_decommits) } // note: cannot enable this if secure is on
|
{ 0, UNINIT, MI_OPTION(reset_decommits) }, // note: cannot enable this if secure is on
|
||||||
|
{ 100, UNINIT, MI_OPTION(os_tag) } // only apple specific for now but might serve more or less related purpose
|
||||||
};
|
};
|
||||||
|
|
||||||
static void mi_option_init(mi_option_desc_t* desc);
|
static void mi_option_init(mi_option_desc_t* desc);
|
||||||
|
|
4
src/os.c
4
src/os.c
|
@ -288,7 +288,9 @@ static void* mi_unix_mmap(size_t size, size_t try_alignment, int protect_flags)
|
||||||
#endif
|
#endif
|
||||||
#if defined(VM_MAKE_TAG)
|
#if defined(VM_MAKE_TAG)
|
||||||
// macOS: tracking anonymous page with a specific ID. (All up to 98 are taken officially but LLVM sanitizers had taken 99)
|
// macOS: tracking anonymous page with a specific ID. (All up to 98 are taken officially but LLVM sanitizers had taken 99)
|
||||||
fd = VM_MAKE_TAG(100);
|
int os_tag = (int)mi_option_get(mi_option_os_tag);
|
||||||
|
if (os_tag < 100 || os_tag > 255) os_tag = 100;
|
||||||
|
fd = VM_MAKE_TAG(os_tag);
|
||||||
#endif
|
#endif
|
||||||
if (use_large_os_page(size, try_alignment)) {
|
if (use_large_os_page(size, try_alignment)) {
|
||||||
static volatile _Atomic(uintptr_t) large_page_try_ok; // = 0;
|
static volatile _Atomic(uintptr_t) large_page_try_ok; // = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue