In Search Of The Best Rust Memory Allocator
In Search Of The Best Rust Memory Allocator
In Search Of The Best Rust Memory Allocator

I wrote about the memory woes I've been experiencing once I deployed this application to production. One of the solutions I came to learn about was the use of custom allocators.

You see, Rust uses its inbuilt standard allocator that depends on libmalloc. Sometime prior to version 1.32 it was using jemalloc, a FreeBSD memory allocator. Unfortunately, jemalloc is dead as we speak. Yet, many Rust tuorials and posts recommend it. When I tried it out the build failed so jemalloc should not be used.

But there are other better alternatives to Rust's standard allocator and jemalloc:

  • Mimalloc: This is a general purpose memory allocator created by Microsoft. Performance is better than jemalloc and it comes with some of the best memory security features.
  • Tcmalloc: Created by Google, it has better throughput than Mimalloc.

There are Rust crates for each but if you would like to use a single shot to activate the best memory allocator depending on the architecture you are deploying to you can use the Malloc Best Effort crate.

Back to work now in trying to set up a memory allocator for this application and watch it carefully to see where the bad memory usage problem is coming from.

WORDCOUNT: 211 words.

Latest Blog Posts

  1. How to gracefully shutdown a Rust application.
    11 Mar 2026
  2. Creating post hit counter for FolderHQ and its complexities.
    02 Mar 2026
  3. How to setup CORS layer in a Rust application.
    23 Feb 2026
  4. Why your Rust release build tends to use so much memory.
    09 Feb 2026
  5. The main 2 reasons I moved away from Go/Golang and towards Rust.
    07 Feb 2026