Mimalloc: Difference between revisions

From Alpine Linux
(created new page for mimalloc)
 
 
Line 7: Line 7:
== Configuration ==  
== Configuration ==  


To minimize risks while leveraging mimalloc, consider Per-Application Preloading:
To minimize risks while leveraging mimalloc, consider [[#Using mimalloc per-application|per-application preloading]].


=== Using mimalloc per-application ===
=== Using mimalloc per-application ===
Line 32: Line 32:
== See also ==
== See also ==
[https://github.com/microsoft/mimalloc Official website]
[https://github.com/microsoft/mimalloc Official website]
[[Category:System Administration]]

Latest revision as of 17:46, 27 January 2025

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

Note: Using mimalloc systemwide is not recommeneded as this is not guranteed to work for all applications. Test your critical applications using per-application before deploying it 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

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Set LD_PRELOAD to use mimalloc globally export LD_PRELOAD=/usr/lib/libmimalloc.so export PAGER=less umask 022 ...

See also

Official website