microsoft / microsoft/mimalloc
MI_HINT area is outside the VA range on some systems
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
MI_HINT_BASE is defined to be 2 TiB, but on some systems this is outside the VA range.
In particular, the AArch64 default config in Linux selects a 39-bit VA size (512GB), though many distributions do use 48-bit VAs. There is also an option for 36-bit addresses, though that is guarded behind EXPERT and unlikely to be widely used.
RISC-V also appears to limit VAs to 39 bits in some situations.
Because of this, any program linking mimalloc on an affected system will print this warning:
$ LD_PRELOAD=libmimalloc.so.2.0 ls
mimalloc: warning: unable to allocate aligned OS memory directly, fall back to over-allocation (67108864 bytes, address: 0x7f8fded000, alignment: 67108864, commit: 1)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/os.c at lines 315-317 and trace how MI_HINT_BASE is used when requesting aligned OS memory. Compare that assumption with the AArch64 and RISC-V virtual-address limits described in the issue, including the 39-bit Linux configuration. Done means the affected systems no longer produce the reported fallback warning while preserving the intended aligned allocation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100