DEV Community

Cover image for Ruby + jemalloc on a micro EC2 instance

Ruby + jemalloc on a micro EC2 instance

Gonzalo Moreno on September 27, 2019

After reading several articles about how badly it manages ruby memory, I wanted to do a test on a small application that I run with Ruby on Rails a...
Collapse
 
pjmartorell profile image
Pere Joan Martorell

Read this: github.com/fullstaq-labs/fullstaq-...

"The Ruby core team have debated for years on whether to incorporate Jemalloc, and so far they've only been reluctant. Furthermore, Hongli Lai's research and discussions with various experts have revealed that the only way to make optimal use of Jemalloc is through the LD_PRELOAD mechanism: compiling Ruby with --with-jemalloc is not enough! LD_PRELOAD is such an intrusive and platform-specific change, that we're confident that the Ruby core team will never accept using such a mechanism by default."

Collapse
 
wevtimoteo profile image
Weverton Timoteo

For any others that may come along, in Ruby 2.6.x it is:

RbConfig::CONFIG['MAINLIBS']
Enter fullscreen mode Exit fullscreen mode

For more information: bugs.ruby-lang.org/issues/15470

Collapse
 
rodolfobandeira profile image
Rodolfo

I've been using Jemalloc with Ruby 2.6.6. It just solved all my problems for Rails Sidekiq eating memory to the infinite. It is just amazing!