Malloc_arena_max

Since a while MALLOC_ARENA_MAX is added to Sidekiq’s systemd file. I understand that this is to tame the memory behavior of glibc. Questions:

  1. What will happen when I don’t add MALLOC_ARENA_MAX=2 to Sidekiq’s service file. As there a default?

  2. I run 3 different sidekiq processes with different concurrencies. Should I add to all processes MALLOC_ARENA_MAX=2?

  3. What happens when I increase MALLOC_ARENA_MAX to for example 4? I 20 GB RAM (on a cheap VPS), so when I increase MALLOC_ARENA_MAX would this increase the RAM and decrease CPU load?

Thanks in advance for answering this. I searched the internet, but I didn’t find complete answers to those questions.

You might want to have a look at Tuning glibc Memory Behavior | Heroku Dev Center
It explains the default values, among others.

Yes, it is a per-process setting, so you might want to set it for all processes.

Thanks for your reply. I already checked that page (and the linked pages), but it only talks about MALLOC_ARENA_MAX=2, not why and what a higher number does.