mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

memory usage regression on arm32 devices in 2.2.2 comparing to 2.1.2

Open Noxybot opened this issue 8 months ago • 3 comments

Hi! Thanks for the cool allocator! I have a small question... I'm noticing a regression when trying to update mimalloc from 2.1.2 to 2.2.2. In particular, 2.2.2 seems to crash much much more (2.5 times more) on arm32 Android devices. The symptom of the crash is that mi_malloc can spontaneously return nullptr (which looks like OOM, but in realty it's not - according to available memory). Also, the ratio of such failures is much higher in 2.2.2 as compared to 2.1.2, so that's why I suspect some regression was introduced. Do you have any clues of what might be happening here? To me it looks like we exhaust virtual 32 bit address space (but not physical memory)...

Noxybot avatar Mar 26 '25 16:03 Noxybot

This is difficult to say without more info.. Is this on Linux or a BSD? The default virtual reserve is 128MiB on 32-bit -- you could try to set it to a lower setting? MIMALLOC_ARENA_RESERVE=64MiB for example. Another thing to try is the v3 (dev3 branch) as that version has a fallback path if the virtual reserve fails (this needs to be backported...) (also, try to run with MIMALLOC_VERBOSE=1 to see what call actually fails)

daanx avatar Mar 28 '25 20:03 daanx

It's on "Linux" (Android). I will try MIMALLOC_ARENA_RESERVE=64MiB. I can't try MIMALLOC_VERBOSE=1 since I'm unable to repro the problem locally, but only noticing it on scale when doing A/B test.

Noxybot avatar Mar 28 '25 22:03 Noxybot

Ah I see. Let me know how it goes! (if it still fails more, I can try to backport the virtual reserve fallback from v3 and see if it improves).

daanx avatar Mar 28 '25 22:03 daanx