Step 1 :
Option 1 : Compile from source (latest version)
*** This option is not recommended for Ubuntu 16.04 LTS Desktop and Kali Linux 2016.2. When using in Ubuntu 16.04 LTS Desktop, Firefox will be crashed when 2 or more instances are opened. Meanwhile, Kali Linux 2016.2 requires redis-server which is using stock version of libjemalloc1 by default. redis-server for Ubuntu 16.04 also requires stock version of libjemalloc1.
git clone https://github.com/jemalloc/jemalloc.git
cd jemalloc
./autogen.sh
make dist
make
sudo make install
The final files "libjemalloc.*" are located at "/usr/local/lib/".
touch /etc/ld.so.preload
echo "/usr/local/lib/libjemalloc.so" | sudo tee --append /etc/ld.so.preload
Option 2 : Install package (usually older version)
This option is recommended for Ubuntu 16.04 LTS and Kali Linux 2016.2.
sudo apt-get install libjemalloc1 libjemalloc-dev
The final files "libjemalloc.*" are located at "/usr/lib/x86_64-linux-gnu/".
touch /etc/ld.so.preload
echo "/usr/lib/x86_64-linux-gnu/libjemalloc.so" | sudo tee --append /etc/ld.so.preload
sudo ln -s /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 /usr/lib/x86_64-linux-gnu/libjemalloc.so
Step 2 :
Reboot your box.
Step 3 :
To confirm it is running properly (for example, firefox is running with it) :
sudo lsof -E | grep libjemalloc | grep firefox
That's all! See you.