mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-12 06:08:42 +03:00
Fix incorrect MAP_HUGE_1GB check
MAP_HUGE_1GB and MAP_HUGE_2MB are not single bit flags. MAP_HUGE_1GB = 30 << 26. MAP_HUGE_2MB = 21 << 26. MAP_HUGE_1GB & MAP_HUGE_2MB != 0.
This commit is contained in:
parent
4e50d6714d
commit
8e0eefda3b
1 changed files with 1 additions and 1 deletions
|
@ -276,7 +276,7 @@ static void* unix_mmap(void* addr, size_t size, size_t try_alignment, int protec
|
|||
*is_large = true;
|
||||
p = unix_mmap_prim(addr, size, try_alignment, protect_flags, lflags, lfd);
|
||||
#ifdef MAP_HUGE_1GB
|
||||
if (p == NULL && (lflags & MAP_HUGE_1GB) != 0) {
|
||||
if (p == NULL && (lflags & MAP_HUGE_1GB) == MAP_HUGE_1GB) {
|
||||
mi_huge_pages_available = false; // don't try huge 1GiB pages again
|
||||
_mi_warning_message("unable to allocate huge (1GiB) page, trying large (2MiB) pages instead (errno: %i)\n", errno);
|
||||
lflags = ((lflags & ~MAP_HUGE_1GB) | MAP_HUGE_2MB);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue