by scryfall

GitHub Readme.md


This Heroku buildpack installs jemalloc on your dynos. jemalloc is an alternative implementation of malloc(3), a low-level C function that allocates memory. Projects that swap in jemalloc often see a reduction in memory fragmentation and overall memory use.

jemalloc works automatically with Heroku deployments for Ruby, Node, Python, and other languages that manage memory for you.

This buildpack supports the following Heroku stacks:

  • cedar-14 (deprecated)
  • heroku-16
  • heroku-18


Heroku supports using multiple buildpacks for an app:

heroku buildpacks:add --index 1 https://github.com/scryfall/heroku-buildpack-jemalloc.git
git push heroku master


You can load jemalloc on a per-process basis in your Procfile by prepending commands with jemalloc.sh:

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

You can also set JEMALLOC_ENABLED to true in your environment config to load jemalloc automatically for all processes on your project:

heroku config:set JEMALLOC_ENABLED=true

Choosing a version

You can switch between jemalloc versions by setting JEMALLOC_VERSION in your environment. The setting will take effect the next time you build a new slug.

heroku config:set JEMALLOC_VERSION=5.1.0
git push heroku master

You should test each version of jemalloc with your app under load to find the best behavior. Each project has unique memory needs.

Available versions:

Version cedar-14 heroku-16 heroku-18 Notes 3.6.0 (link) (link) (link) 4.0.4 (link) (link) (link) 4.1.1 (link) (link) (link) 4.2.1 (link) (link) (link) 4.3.1 (link) (link) (link) 4.4.0 (link) (link) (link) 4.5.0 (link) (link) (link) 5.0.1 (link) (link) (link) 5.1.0 (link) (link) (link) Default version 5.2.0 (link) (link) (link)

jemalloc builds are distributed from dist.scryfall.com. The bundles are linked above for your inspection.


Scryfall hereby releases this project to the public domain.