
Allocators in Rust - adamnemecek
http://smallcultfollowing.com/babysteps/blog/2014/11/14/allocators-in-rust/
======
wyager
Why does the default glibc allocator have relatively poor performance? (What
makes it slower, and why hasn't it been changed?)

~~~
dmix
This stuff is out of the scope of my knowledge, but I do know libraries such
as OpenBSD's memory allocator are slower due to security optimizations.
jemalloc is not known for it's security, instead it seems to be focused on
performance. Security features such as ASLR, not leaving old memory around,
zeroing out memory on release, etc, are not things that improve an allocators
performance.

~~~
wyager
Good point. I wonder if Rust's allocator needs fewer security features because
of heavy compile-time heap safety checking. For example, I don't believe use-
after-free or double-free is possible in Rust due to Rust's lifetime system
(barring use of unsafe code blocks).

~~~
musername
I second that question, as it was my first thought about the difference to the
malloc in glibc, or whether it's just ignoring the supposed benefits.

------
rdw
I was curious about Rust's support for within-application custom allocators,
it looks like this is still under discussion: [https://github.com/rust-
lang/rfcs/pull/244](https://github.com/rust-lang/rfcs/pull/244)

------
rdc12
"How much allocation takes place in Rust vs in the other language?"

Wouldn't the distribution of the allocations matter too, switching between the
two allocators frequently showing the worst case and reuse of one of two
minimising the effect.

