Jemalloc Buildpack

Purpose of this buildpack

Jemalloc is a general purpose malloc implementation that works to avoid memory fragmentation in multithreaded applications. This buildpack makes it easy to install and use jemalloc with your apps.

Set up this buildpack for your application

This buildpack is designed to be used in conjunction with one or more additional buildpacks, thanks to the multi buildpack.

For instance, when creating a new Ruby app on Scalingo:

$ scalingo create my-app

$ cat << EOF > .buildpacks
https://github.com/Scalingo/jemalloc-buildpack.git
https://github.com/Scalingo/ruby-buildpack.git
EOF

The above commands configure your application to use the multi buildpack, and define the .buildpacks file. This file configures the different buildpacks to apply. In this example, we configure the jemalloc and the Ruby buildpack.

Configuration

Set the JEMALLOC_ENABLED config option to true and jemalloc will be used for all commands run inside of your containers.

scalingo env-set JEMALLOC_ENABLED=true

Per Container Type

To control when jemalloc is configured on a per container basis, use jemalloc.sh <cmd> and ensure that JEMALLOC_ENABLED is unset.

Example Procfile:

web: jemalloc.sh bundle exec puma -C config/puma.rb

jemalloc Versions

Availability

The following jemalloc versions are available:

jemalloc Version scalingo-22 scalingo-24
5.3 Up to 5.3.1 Up to 5.3.1

Select a Version

The default jemalloc version on all stacks is the latest 5.3 version. If you need to install another version, please use the JEMALLOC_VERSION environment variable, like so:

scalingo env-set JEMALLOC_VERSION=4.5.0

Suggest edits

Jemalloc Buildpack

©2026 Scalingo