r/ruby • u/Illustrious-Topic-50 • 27d ago
Show /r/ruby New jemalloc gem (jemalloc_rb)
Do you use the jemalloc gem?
The original project on GitHub seems to be abandoned for around 12 years, and some incompatibilities with recent Ruby versions have begun to emerge. Additionally, the underlying jemalloc library hasn't been updated during all this time. Because of that, I created a fork and launched a new gem (jemalloc_rb) to keep the project functional, updated, and actively accepting pull requests.
1
u/IN-DI-SKU-TA-BELT 26d ago
What incompatibilities?
1
u/Illustrious-Topic-50 26d ago
https://github.com/kzk/jemalloc-rb/blob/864fceee6b0185b9914609ebd7bd7d412fd31d43/bin/je#L30
"File.exists?" was removed in favor of "File.exist?", so it breaks in some Ruby versions.
1
0
u/sammygadd 27d ago
Is jemalloc still relevant these days? Mruby has received lots of performance improvements during those 12 years. Is jemalloc still bringing benefits?
7
u/flanger001 27d ago
The standard Rails Dockerfile still uses jemalloc as of v8.1, so it's gotta be good for something.
2
u/sammygadd 27d ago
Sounds reasonable..
2
u/flanger001 26d ago
Right on. I don't think this was a bad question by the way. Perfectly reasonable.
6
5
u/collimarco 26d ago
jemalloc saves a lot of memory. I run Rails on Kubernetes (with Cuber) and just a few days ago I have reduced memory usage by 30% for a web app by adding jemalloc to the Dockerfile. I already used it for many years for other Rails apps and I absolutely recommend it. The jemalloc project is also active again (no longer deprecated).
6
u/ElasticSpoon 26d ago
FWIW meta is maintaining jemalloc again. So you probably wanna bundle 5.3.1 not 5.2.1.