mi_reserve_os_memory fails to use 2MB hugepages when reserving >1GB memory
Hi,
I am currently using a Linux system where the only hugepage size available is 2MB. With mimalloc 2.0.9, when I tried to use mi_reserve_os_memory to reserve 4GB memory, I got the following warning message:
mimalloc: warning: unable to allocate aligned OS memory directly, fall back to over-allocation (4294967296 bytes, address: 0x7ffef7200000, alignment: 33554432, commit: 1)
It appears that mi_os_get_aligned_hint always return NULL for size > 1GB (I understand this behavior is related to #372). Thus, without an alignment hint, the result of mi_os_mem_alloc is unlikely aligned to MI_SEGMENT_ALIGN (32MB), which results in the fall back to over-allocation.
Is there a workaround to achieve my goal? Or should I configure the system to enable 1GB hugepages? Thank you!
I encountered the same problem. For my purpose, it suffices to simply modify the source code, bumping up the threshold from 1GiB to a value to my satisfaction, at the cost of reduced ASLR security (which I don't care that much in my project).