This repo is an evaluation platform for memory allocators in C++.
We comparing self-made allocators with default malloc
/free
and participants.
Default C's malloc
/free
allocator is effective in memory consumption, but works slow,
when comparing with other approaches which are not-so strong in memory economy.
So in this contest we testing custom-developed allocators with the standard one by measuring average relation speed to memory overhead.
To compare allocators we compute and sum scores for several tests: small, medium, large, random. The more the total sum - the better.
The score for each test is inversely proportional to the computation time and memory overhead.
The allocator test environment works in Windows, VS 2019. You need at least 16 Gb of RAM, and 80 Gb of swap disks.
To develop and test your allocator, do the following:
-
Use
DefaultMallocAllocator
atMemoryAllocatorContest.cpp
as a scratch. -
Add your class to the list of allocators to test at the beginning of the
main()
:results.push_back(TestCase_MemoryPerformance<...>::RunTests());
(Of course it's better to comment others allocator testing during your development.)
- Run. The program outputs total scores and forms
results.html
with graphs of time and memory consumption.
The results are in folder MemoryAllocatorResults
, especially Results.txt
file.
-
AlexeiMikhailov: uses pools 2^n and lists.
-
OlegApanasik: uses 2^n multi-pools with free-list and without any loop.
-
DefaultMallocAlloc: default
malloc
/free
allocator. Slow but very effective in memory. -
DaniilPavlenko: uses single multiset to store all free memory chunks.
-
AlexeyAntropov: uses multi-pools O(1) for small allocations [1, 256] and heap allocator with varied block size, ~O(sqrt(n)) for alloc and O(1) for free, where n is num of blocks in free list.
-
DenisPerevalov: uses several 2^n pools without reusing. Parameters (
table[]
) are tweaked specially to maximize the scores. -
AntonShatalov: uses binary-coded 6-tree with cache-usage optimizations. Extremely fast on Medium test.