Open infn-ke opened 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):
Reduce the page size from 64KiB:
#define MI_SEGMENT_SLICE_SHIFT (13 + MI_INTPTR_SHIFT)
to 32KiB: (which also halves the segment size and medium page size)
#define MI_SEGMENT_SLICE_SHIFT (12 + MI_INTPTR_SHIFT)
You can also reduce the MI_MINIMAL_COMMIT_SIZE
from:
#define MI_MINIMAL_COMMIT_SIZE (16*MI_SEGMENT_SLICE_SIZE)
to
#define MI_MINIMAL_COMMIT_SIZE (1*MI_SEGMENT_SLICE_SIZE)
Set the option MIMALLOC_DECOMMIT_EXTEND=0
to allow more aggressive decommit
Set the option MIMALLOC_EAGER_COMMIT=0
to always commit on-demand
Hope this helps!
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.