Project

General

Profile

Feature #14759

[PATCH] set M_ARENA_MAX for glibc malloc

Added by normalperson (Eric Wong) about 2 years ago. Updated about 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:87035]

Description

Not everybody benefits from jemalloc and the extra download+install
time is not always worth it. Lets make the user experience for
glibc malloc users better, too.

Personally, I prefer using M_ARENA_MAX=1 (via MALLOC_ARENA_MAX
env) myself, but there is currently a performance penalty for
that.

gc.c (Init_GC): set M_ARENA_MAX=2 for glibc malloc

glibc malloc creates too many arenas and leads to fragmentation.
Given the existence of the GVL, clamping to two arenas seems
to be a reasonable trade-off for performance and memory usage.

Some users (including myself for several years, now) prefer only
one arena, now, so continue to respect users' wishes when
MALLOC_ARENA_MAX is set.

Thanks to Mike Perham for the reminder [ruby-core:86843]

This doesn't seem to conflict with jemalloc, so it should be safe
for all glibc-using systems.


Files


Related issues

Related to Ruby master - Feature #15667: Introduce malloc_trim(0) in full gc cyclesOpenActions

Also available in: Atom PDF