gem install jemalloc && bundle exec je ./script/rails s
Instant jemalloc injection into Ruby apps, for better performance and less memory.
Ruby relies on malloc(3) for its internal memory allocation. Using better malloc() implementation will boost your application performance, and supress the memory usage.
jemalloc is a malloc(3) implementation, originally developed by Jason Evans. jemalloc handles small object better than other allocators so usually gives better performance and memory usage to Ruby programs.
Installing jemalloc separately from Ruby is pain in some cases (e.g. Heroku, EngineYard, etc).
jegem contains jemalloc itself within a gem, and enables instant jemalloc injection in a really easy way: install
jegem, and launch your app with
jemallocgem in your application. For bundler based application, please add the following line into your Gemfile, and and install
Execute your application with
jecommand, which is contained in
jegem. Example command for Rails + bundler application is like follows.
$ bundle exec je ./script/rails s
-voption will let you confirm jemalloc is actually injected.
$ bundle exec je -v ./script/rails s => Injecting jemalloc... => Booting WEBrick ...
Currently, this gem works only on Linux and Mac OS X.