Is Elixir friendly in terms of memory management?

Hello everyone,
Currently working on using nodejs for the Rest API and the team lead wants to use either rust or elixir with a focus on memory. Is elixir friendly in terms of memory management?. Thanks!

Elixir runs on the Beam VM, which handles memory management for you. Most elixir apps use very little memory.

Memory Footprint based on app size:

  • Small: 150 - 180 MB
  • Medium: 200 - 280 MB
  • Large: > 300MB

Building Rest API with Elixir is the right choice because it abstracts enough a way to allow you to focus on your application rather than worrying about low level memory management.

Rust is good if you are building system level apps like desktop application, or apps that get deployed to low memory environments.

If you are building for the web and deploy to the cloud, you probably will not gain anything by using rust, when it comes to memory footprint. Since a starting level VM will give you about 1GB. That’s plenty of RAM for Elixir.

9 Likes

Thanks very much,

1 Like

I think it’s also worth mentioning that Elixir and other BEAM languages are garbage collected but they are quite unique in the fact there are no stop the world pauses, since every process (Erlang processes, not OS processes) have their own memory and are being garbage collected individually.

So you get the benefit of not having to manage memory manually (or deal with the borrow checker) without the downside of typical GC-ed languages.

6 Likes

Good to know :slight_smile: