microsoft / mimalloc

mimalloc is a compact general purpose allocator with excellent performance.
MIT License
10.65k stars 873 forks source link

Tuning for small system? #647

Open infn-ke opened 2 years ago

infn-ke commented 2 years ago

Is there any tuning parameters for optimizing mimalloc for small memory footprint? In e.g. tcmalloc there is page size, alignment etc. that can be tuned. Can the free list be returned to the system by an explicit call? Is allocation done with mmap or sbrk etc.

daanx commented 2 years ago

The latest dev-slice has been improved recently with regard to memory usage so try that first. What is "small" in this case (e.g. what memory footprint are you looking at? 64MiB, 1GiB ??). Also, mimalloc reduces fragmentation by relying on the MMU to commit/decommit memory inside a larger "reserved" address space so an MMU is important.

Further tweaks in mimalloc-types.h (v2, `dev-slice):

Hope this helps!