blob: 30d4abc2af6d577799c9e9734181003abfb6b542 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# Allocators
allocbench supports three mechanisms to change the used allocator for program
run with exec. The easiest is using `LD_PRELOAD` to overwrite `malloc/free`
with the functions of a shared library like libtcmalloc.so. If LD_PRELOAD
can't be used you can specify a command prefix to somehow load and use your allocator.
This command prefix is used for different versions of glibc. The command is
prefixed with the loader of the glibc version to test. *Note that the whole glibc
is changed maybe tampering with the results*. Additionally binary suffixes are
supported. This could be used to use with `patchelf` patched binaries to
use different `rpath` or `linker`.
The used allocators are stored in a global python dictionary associating
their names with the fields: `cmd_prefix, binary_suffix, LD_PRELOAD` and `color`.
By default this dictionary is build from locally installed allocators found by `whereis`.
You can overwrite the default allocators with the `-a | --allocators` option
and a python script exporting a global dictionary with the name `allocators`.
## Included Allocators
* lockless allocator
* supermalloc
* glibc
* mesh
* scalloc
* tbbmalloc
* bumpptr
* jemalloc
* mimalloc
* scalloc
* hoard
* snmalloc
* tcmalloc
## Building Allocators
To reproducible build allocators and patched version you can use the
classes `Allocator` and `Allocator_Sources` provided in `src/allocator.py`.
See [allocators/no_falsesharing.py](allocators/no_falsesharing.py) or
[allocators/BA_allocators.py](allocators/BA_allocators.py) for examples.
|