Mimalloc
Mimalloc is a drop-in replacement for malloc and can be used in other programs without code changes, for example, on dynamically linked ELF-based systems.
Installation
To use mimalloc, ensure mimalloc package is installed on your Alpine Linux system:
# apk add mimalloc
Configuration
To minimize risks while leveraging mimalloc, consider per-application preloading.
Using mimalloc per-application
Preload libmimalloc.so only for specific applications by issuing the following command:
LD_PRELOAD=/usr/lib/libmimalloc.so my-application
If preloading fails or causes issues, you can unset it temporarily:
unset LD_PRELOAD
To use mimalloc for firefox:
LD_PRELOAD=/usr/lib/libmimalloc.so firefox
Using mimalloc systemwide
To preload libmimalloc.so systemwide, set the LD_PRELOAD environment variable globally by adding the line export LD_PRELOAD=/usr/lib/libmimalloc.so to the global shell configuration file /etc/profile as follows:
Contents of /etc/profile