Description
Hello,
I work on a game where we would like to use mimalloc because of its performance, especially in multithreaded scenarios.
So far we have been using dlmalloc which is slow when multiple threads allocate in parallel.
I have noticed that mimalloc, at least in our game, has significantly more committed memory at a given time than dlmalloc. When comparing both allocators in a typical scenario of high memory usage, mimalloc can have 700MB to 1GB more committed memory than dlmalloc, out of a total of ~20GB committed memory for the game's process. At the same time, the working set size can be 400MB lower for mimalloc than dlmalloc!
While this is fine on PC (Windows), it is a problem on consoles where we cannot commit more memory than there is actual RAM on the system, so this extra committed memory is essentially wasted RAM.
I have tried several options to reduce the commit size, as seen in these issues: #647, #537
- Disable eager_commit
- Set purge_delay to 0
- Set purge_decommits to 1
- Calling mi_collect(true) regularly on worker threads
- Changing the value of MI_SEGMENT_SLICE_SHIFT from 64kB to 32kB (also tried with 128kB)
None of these had a significant impact.
We are currently using mimalloc v2.1.7. I also tried v3.1.4 and the commit size was roughly the same.
Is this a behavior you have already seen? Do you have any tips to reduce this commit footprint beside what I already mentioned?
Thanks in advance.