Using jemalloc to Optimize Memory Allocation
- Download the jemalloc PDF:
Introduction
This document describes the proper steps to install libjemalloc.so that is optimized for a user’s Linux system. For any questions regarding this document, please contact Sentieon support at support@sentieon.com.
Background
jemalloc is a memory allocator, optimized for high memory allocation performance and fewer memory fragments in multi-thread scenarios. For more general information about jemalloc, please refer to https://github.com/jemalloc/jemalloc
Sentieon recommends using jemalloc to improve memory management and overall performance in Sentieon applications, especially Sentieon bwa-mem.
Installation
Sentieon recommends installing a pre-built libjemalloc.so. Users may need root access to complete the installation.
RHEL 8 and 9, Rocky Linux, AlmaLinux
jemalloc is in the EPEL repository. On Rocky Linux and AlmaLinux,
dnf install epel-release enables it; on RHEL, follow the EPEL
instructions at https://docs.fedoraproject.org/en-US/epel/.
dnf install epel-release
dnf install jemalloc
By default, the libjemalloc.so is installed at
/usr/lib64/libjemalloc.so.2
Ubuntu 20.04 and later, Debian 11 and later
apt update
apt install libjemalloc2
By default, the libjemalloc.so is installed at
/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
Other systems without a prebuilt package
Please refer to INSTALL.md on the jemalloc GitHub page, https://github.com/jemalloc/jemalloc, for more information on how to build and install jemalloc.
Loading jemalloc in a Sentieon pipeline
The LD_PRELOAD environment variable can be used to load the jemalloc library in Sentieon at run time.
For example, on a RHEL 9 system, you can use the following code to set this environment variable before running the Sentieon tools:
export LD_PRELOAD=/usr/lib64/libjemalloc.so.2