TCMalloc is a thread-caching malloc implementation designed to reduce fragmentation in multithreaded applications. This buildpack makes it easy to install and use TCMalloc on Heroku and compatible platforms.
heroku buildpacks:add https://github.com/gaffneyc/heroku-buildpack-tcmalloc.git
git push heroku master
Continued development and support of the tcmalloc buildpack is sponsored by Dead Man's Snitch.
Ever been surprised that a critical recurring job was silently failing to run? Whether it's backups, cache clearing, sending invoices, or whatever your application depends on, Dead Man's Snitch makes it easy to monitor heroku scheduler tasks or to add cron job monitoring to your other services.
Get started for free today with Dead Man's Snitch on Heroku
Set the TCMALLOC_ENABLED config option to true and tcmalloc will be used for all commands run inside of your dynos.
heroku config:set TCMALLOC_ENABLED=true
To control when tcmalloc is configured on a per dyno basis use
tcmalloc.sh <cmd>
and ensure that TCMALLOC_ENABLED is unset.
Example Procfile:
web: tcmalloc.sh bundle exec puma -C config/puma.rb
Set this to true to automatically enable tcmalloc.
heroku config:set TCMALLOC_ENABLED=true
To disable tcmalloc set the option to false. This will cause the application to restart disabling tcmalloc.
heroku config:set TCMALLOC_ENABLED=false
Set this to select or pin to a specific version of tcmalloc. The default is to use the latest stable version if this is not set. You will receive an error mentioning tar if the version does not exist.
Default: 2.7
note: This setting is only used during slug compilation. Changing it will require a code change to be deployed in order to take affect.
heroku config:set TCMALLOC_VERSION=2.7
Version | Released |
---|---|
2.7 | 2018-04-30 |
2.8 | 2020-07-06 |
2.8.1 | 2020-12-21 |
2.9 | 2021-02-21 |
2.9.1 | 2021-03-02 |
The complete and most up to date list of supported versions and stacks is available on the releases page.
This uses Docker to build against Heroku stack-image-like images.
make VERSION=2.7
Artifacts will be dropped in dist/
based on Heroku stack and tcmalloc version.
make VERSION=X.Y.Z
open dist
- Go to releases
- Edit the release corresponding to each heroku Stack
- Drag and drop the new build to attach
- Go to releases
- Click "Draft a new release"
- Tag is the name of the Stack (e.g.
heroku-18
) - Target is
release-master
- Title is
Builds for the [stack] stack