This is orthogonal to tenderlove's GC work, but if you're using MRI and want an easy memory usage/performance win, swap out the standard glibc malloc for jemalloc: https://www.levups.com/en/blog/2017/optimize_ruby_memory_usa...
Kind of a tangent, but does anyone know why glibc’s allocator loses to jemalloc on common workloads? I would expect that would be something worth rectifying unless other requirements tie their hands.
Jemalloc implements more complex strategies (per-thread caches learned from tcmalloc, preallocated arenas, …).
It tends to have a somewhat higher memory use than simpler allocators, but have faster throughput and less fragmentation (the latter is why Firefox switched to jemalloc by default IIRC).
> I would expect that would be something worth rectifying unless other requirements tie their hands.
Why? If they consider ptmalloc good enough for their purpose, replacing it would be very low priority, and they may value e.g. code simplicity higher.
Incidentally, there was talk at one point to replace glibc's ptmalloc: https://sourceware.org/ml/libc-alpha/2014-10/msg00419.html