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 jemalloc is and how it relates to Ruby /Ruby on Rails

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

Why is jemalloc important to Ruby /Rails?

Ruby uses malloc to manage memory, especially when dealing with objects. Under high load conditions (such as multi-threaded Puma or Sidekiq), a standard allocator can cause memory fragmentation and slow cleaning.
By replacing malloc with jemalloc, you can get:
  • Less memory consumption on long-term processes
  • Stabler RSS (Resident Set Size)
  • Potentially faster GC (Garbage Collector) because jemalloc manages the placement of objects better

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

If you see your Ruby /Rails processes "blow up" in memory after hours or days of — jemalloc can help a lot.
This is especially noticeable on:
  • Sidekiq /Resque
  • Puma /Unicorn under load
  • Services with long-term processes

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

Where can I find the older version of Google Chrome and download it? On the example of an old Mac
25 Apr 23:02

Where can I find the older version of Google Chrome and download it? On the example of an old Mac

meme code
meme code@memecode
09 May 19:27

[FIXED] cannot load such file -- html/pipeline (LoadError) виникає під час rails generate thredded:install

meme code
meme code@memecode
Задача: Перетворення римського числа на десяткове (Ruby)
20 May 12:05

Задача: Перетворення римського числа на десяткове (Ruby)

meme code
meme code@memecode
Задача на перевірку правильності розстановки дужок (Ruby)
21 May 10:27

Задача на перевірку правильності розстановки дужок (Ruby)

meme code
meme code@memecode
Як знайти підмасив з максимальною сумою (Maximum Subarray Sum) в Ruby
22 May 11:01

Як знайти підмасив з максимальною сумою (Maximum Subarray Sum) в Ruby

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

Google Ads for Dummies: A Step-by-Step Guide to 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 became very small after updating Chrome
05 Jun 18:23

The preview in the network tab became very small after updating Chrome

meme code
meme code@memecode
What is the HEIC format and why just rename it .jpg — is a bad idea
15 Jun 18:17

What is the HEIC format and why just rename it .jpg — is a bad idea

meme code
meme code@memecode
Чому вибір CMS важливий під час розробки сайту?
29 Jun 12:34

Чому вибір CMS важливий під час розробки сайту?

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

Error 403 on the site: what it means and how to eliminate it

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

What is vibe coding?

meme code
meme code@memecode