From: "hackeron (Roman Gaufman) via ruby-core" Date: 2024-02-07T09:04:07+00:00 Subject: [ruby-core:116614] [Ruby master Feature#9113] Ship Ruby for Linux with jemalloc out-of-the-box Issue #9113 has been updated by hackeron (Roman Gaufman). We've been using jemalloc since 2018 and it cut our memory use to 1/5, it also stopped us needing to restart our app every 3-4 days as the memory slowly leaked. It is staggering to me why this isn't the default, until we discovered jemalloc we were actively looking to stop using Ruby for its memory bloating and leaking. ---------------------------------------- Feature #9113: Ship Ruby for Linux with jemalloc out-of-the-box https://bugs.ruby-lang.org/issues/9113#change-106627 * Author: sam.saffron (Sam Saffron) * Status: Closed * Priority: Normal ---------------------------------------- libc's malloc is a problem, it fragments badly meaning forks share less memory and is slow compared to tcmalloc or jemalloc. both jemalloc and tcmalloc are heavily battle tested and stable. 2 years ago redis picked up the jemalloc dependency see: http://oldblog.antirez.com/post/everything-about-redis-24.html To quote antirez: `` But an allocator is a serious thing. Since we introduced the specially encoded data types Redis started suffering from fragmentation. We tried different things to fix the problem, but basically the Linux default allocator in glibc sucks really, really hard. `` --- I recently benched Discourse with tcmalloc / jemalloc and default and noticed 2 very important thing: median request time reduce by up to 10% (under both) PSS (proportional share size) is reduced by 10% under jemalloc and 8% under tcmalloc. We can always use LD_PRELOAD to yank these in, but my concern is that standard distributions are using a far from optimal memory allocator. It would be awesome if the build, out-of-the-box, just checked if it was on Linux (eg: https://github.com/antirez/redis/blob/unstable/src/Makefile#L30-L34 ) and then used jemalloc instead. ---Files-------------------------------- 0001-configure.in-add-with-jemalloc-option.patch (1.29 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/