Microsoft has opened a library under the MIT license
The key feature of mimalloc is its compact implementation (less than 3500 lines of code) and very high performance. IN
To evaluate the performance, a set of already existing
High performance is achieved mainly through the use of free list sharding. Instead of a single large list, mimalloc uses a series of smaller lists, each bound to a page of memory. This approach reduces fragmentation and improves data localization in memory. A memory page is a grouped set of blocks of similar size. On 64-bit systems, the page size is typically 64 KB. If there are no occupied blocks left in the page, it is completely freed and memory is returned to the operating system, which reduces memory costs and fragmentation in long-running programs.
The library can be included at the linking stage or loaded for an already built program ("LD_PRELOAD=/usr/bin/libmimalloc.so myprogram"). The library also provides
It is possible to build the library in safe mode, in which special memory check pages (guard-page) are substituted at the block boundary, and block distribution is randomized and lists of freed blocks are encrypted. Such measures allow blocking most typical heap buffer overflow exploitation techniques. When you enable safe mode, performance is reduced by about 3%.
Of the features of mimalloc, it is also noted that it is not susceptible to bloat problems with large fragmentation. In the worst case scenario, memory consumption increases by 0.2% for metadata and can be as high as 16.7% for shared memory. To avoid conflicts when accessing resources, mimalloc uses only atomic operations.
Source: opennet.ru