News for hackers. Stuff that matters.
Re:Reducing Memory Usage in Ruby by ad_hominem on Tuesday January 23, 2018 @07:30PM (#16219284)
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...
Re:Reducing Memory Usage in Ruby by johncolanduoni on Tuesday January 23, 2018 @08:27PM (#16219572)
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.
Re:Reducing Memory Usage in Ruby by __s on Tuesday January 23, 2018 @08:44PM (#16219667)
Quite a few complaints about jemalloc from Rust, where people wonder about higher than necessary memory usage

jemalloc likely wins more for the kinds of allocations you find in scripting language runtimes, which also happens to be similar to a browser given DOM & JS

See also: https://sourceware.org/glibc/wiki/389-ds-malloc

Re:Reducing Memory Usage in Ruby by masklinn on Wednesday January 24, 2018 @03:42AM (#16221284)
> Kind of a tangent, but does anyone know why glibc’s allocator loses to jemalloc on common workloads?

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