All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

What is jemalloc and how does it relate to Ruby / Ruby on Rails

Post cover: What is jemalloc and how does it relate to Ruby / Ruby on Rails
This content has been automatically translated from Ukrainian.
What is jemalloc?. jemalloc (short for Jason Evans malloc) is a high-performance memory allocator that replaces the standard malloc implemented in the standard glibc library. It is used by large projects such as Redis, Firefox, Facebook, and even Android.
Its main advantages:
  • Less memory fragmentation
  • Better multithreaded performance
  • Transparent memory usage logging (through jemalloc profiling)

Why is jemalloc important for Ruby / Rails?

Ruby uses malloc for memory management, especially when working with objects. Under heavy load (for example, multithreaded Puma or Sidekiq), the standard allocator can cause memory fragmentation and slow cleanup.
By replacing malloc with jemalloc, you can achieve:
  • Less memory consumption in long-running processes
  • More stable RSS (Resident Set Size)
  • Potentially faster GC (Garbage Collector), as jemalloc better manages object placement

When does it make sense to enable jemalloc (if you haven't done so yet)?

If you notice that your Ruby / Rails processes are "bloated" in memory after a few hours or days of operation — jemalloc can significantly help.
This is especially noticeable on:
  • Sidekiq / Resque
  • Puma / Unicorn under load
  • Services with long-running processes

This post doesn't have any additions from the author yet.

Where to find an older version of Google Chrome and download it? Using an old Mac as an example.
25 Apr 23:02

Where to find an older version of Google Chrome and download it? Using an old Mac as an example.

meme code
meme code@memecode
09 May 19:27

[FIXED] cannot load such file -- html/pipeline (LoadError) occurs during rails generate thredded:install

meme code
meme code@memecode
Task: Convert a Roman numeral to decimal (Ruby)
20 May 12:05

Task: Convert a Roman numeral to decimal (Ruby)

meme code
meme code@memecode
Task to check the correctness of bracket placement (Ruby)
21 May 10:27

Task to check the correctness of bracket placement (Ruby)

meme code
meme code@memecode
How to find the maximum subarray sum in Ruby
22 May 11:01

How to find the maximum subarray sum in Ruby

meme code
meme code@memecode
Google Ads for Dummies: A Step-by-Step Guide for a Successful Start
28 May 10:21

Google Ads for Dummies: A Step-by-Step Guide for a Successful Start

meme code
meme code@memecode
05 Jun 01:52

[Fixed] uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)

meme code
meme code@memecode
The preview in the network tab after the Chrome update has become very small.
05 Jun 18:23

The preview in the network tab after the Chrome update has become very small.

meme code
meme code@memecode
What is the HEIC format and why simply renaming it to .jpg is a bad idea
15 Jun 18:17

What is the HEIC format and why simply renaming it to .jpg is a bad idea

meme code
meme code@memecode
Why is the choice of CMS important when developing a website?
29 Jun 12:34

Why is the choice of CMS important when developing a website?

meme code
meme code@memecode
Error 403 on the website: what it means and how to fix it
24 Jul 23:50

Error 403 on the website: what it means and how to fix it

meme code
meme code@memecode
What is vibe coding?
25 Jul 21:51

What is vibe coding?

meme code
meme code@memecode