mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

MI_SECURE vs. 16KiB page size: assertion failed

Open dg0yt opened this issue 1 month ago • 1 comments

Running v3.1.5 debug test binaries with MI_SECURE in arm64-osx vcpkg triplet fails in https://github.com/microsoft/mimalloc/blob/dfa50c37d951128b1e77167dd9291081aa88eea4/src/os.c#L55

I realized that gsize is a runtime property obtained via sysconf(_SC_PAGESIZE), and I could verify that its value is 16384 in the affected Apple silicon builds, and that 8192 <= MI_ARENA_SLICE_SIZE/8 < 16384.

Is the assertion too strict, or does the result MI_ARENA_SLICE_SIZE/8 need to change?

I guess that modern Android environments could be affected as well, https://developer.android.com/guide/practices/page-sizes?hl=en.

Background: https://github.com/microsoft/vcpkg/pull/44699

dg0yt avatar Nov 01 '25 11:11 dg0yt

I’m new to mimalloc and also just hit this.

photex avatar Nov 14 '25 15:11 photex

Thanks! I think this is fixed in the latest dev3; actually the assert is just to "warn" that we use smallish slices for such large OS page size. The fix now increases the arena slice size to 128KiB to reduce waste when building in secure mode on arm64 on Apple.

daanx avatar Dec 03 '25 03:12 daanx

Thank you. Did you also consider the Android case?

dg0yt avatar Dec 03 '25 06:12 dg0yt