From: eregontp@... Date: 2018-08-01T20:55:25+00:00 Subject: [ruby-core:88263] [Ruby trunk Feature#14759] [PATCH] set M_ARENA_MAX for glibc malloc Issue #14759 has been updated by Eregon (Benoit Daloze). normalperson (Eric Wong) wrote: > We will probably match arenas to Guild count dynamically; > depending on whether the program uses Guilds or not. > > glibc checks arena_max whenever a new thread allocates memory > for the first time, so arena_max doesn't need to be frozen at > Ruby startup. Ah, great to know! I have no objection then. > I don't know about ko1's timeline, but glibc releases every > 6 months (Aug and Feb); and Carlos's willingness to accept > URCU use in glibc is increasing my interest in contributing > to glibc to fix malloc problems for all GNU users :> It sounds like there is lots of potential there :) ---------------------------------------- Feature #14759: [PATCH] set M_ARENA_MAX for glibc malloc https://bugs.ruby-lang.org/issues/14759#change-73287 * Author: normalperson (Eric Wong) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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-------------------------------- 0001-gc.c-Init_GC-set-M_ARENA_MAX-2-for-glibc-malloc.patch (1.46 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: