mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
further updates to documentation
This commit is contained in:
parent
64730118d3
commit
b5196e5971
3 changed files with 49 additions and 40 deletions
|
@ -26,17 +26,25 @@ without code changes, for example, on Unix you can use it as:
|
|||
|
||||
Notable aspects of the design include:
|
||||
|
||||
- __small and consistent__: the library is less than 6k LOC using simple and
|
||||
- __small and consistent__: the library is about 8k LOC using simple and
|
||||
consistent data structures. This makes it very suitable
|
||||
to integrate and adapt in other projects. For runtime systems it
|
||||
provides hooks for a monotonic _heartbeat_ and deferred freeing (for
|
||||
bounded worst-case times with reference counting).
|
||||
- __free list sharding__: the big idea: instead of one big free list (per size class) we have
|
||||
many smaller lists per memory "page" which both reduces fragmentation
|
||||
and increases locality --
|
||||
- __free list sharding__: instead of one big free list (per size class) we have
|
||||
many smaller lists per "mimalloc page" which reduces fragmentation and
|
||||
increases locality --
|
||||
things that are allocated close in time get allocated close in memory.
|
||||
(A memory "page" in _mimalloc_ contains blocks of one size class and is
|
||||
usually 64KiB on a 64-bit system).
|
||||
(A mimalloc page contains blocks of one size class and is usually 64KiB on a 64-bit system).
|
||||
- __free list multi-sharding__: the big idea! Not only do we shard the free list
|
||||
per mimalloc page, but for each page we have multiple free lists. In particular, there
|
||||
is one list for thread-local `free` operations, and another one for concurrent `free`
|
||||
operations. Free-ing from another thread can now be a single CAS without needing
|
||||
sophisticated coordination between threads. Since there will be
|
||||
thousands of separate free lists, contention is naturally distributed over the heap,
|
||||
and the chance of contending on a single location will be low -- this is quite
|
||||
similar to randomized algorithms like skip lists where adding
|
||||
a random oracle removes the need for a more complex algorithm.
|
||||
- __eager page reset__: when a "page" becomes empty (with increased chance
|
||||
due to free list sharding) the memory is marked to the OS as unused ("reset" or "purged")
|
||||
reducing (real) memory pressure and fragmentation, especially in long running
|
||||
|
@ -51,7 +59,7 @@ Notable aspects of the design include:
|
|||
times (_wcat_), bounded space overhead (~0.2% meta-data, with at most 12.5% waste in allocation sizes),
|
||||
and has no internal points of contention using only atomic operations.
|
||||
- __fast__: In our benchmarks (see [below](#performance)),
|
||||
_mimalloc_ always outperforms all other leading allocators (_jemalloc_, _tcmalloc_, _Hoard_, etc),
|
||||
_mimalloc_ outperforms all other leading allocators (_jemalloc_, _tcmalloc_, _Hoard_, etc),
|
||||
and usually uses less memory (up to 25% more in the worst case). A nice property
|
||||
is that it does consistently well over a wide range of benchmarks.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue