BEAM vs. OS Threads: Minimal Memory Footprint
A typical BEAM process can start with an initial memory footprint as small as 309 words (around 2-3 KB on a 64-bit system), significantly less than an operating system thread, which often defaults to 1-2 MB of stack space alone.
The top 3
- BEAM Process: 1000x Memory Efficiency vs. OS Threads: A BEAM process starts with a memory footprint as low as ~2KB, allowing millions of concurrent instances; in contrast, typical OS threads often require 1-2MB, making BEAM processes 500-1000 times more memory efficient.
- Isolated Heaps & VM-Managed: BEAM's Memory Advantage: BEAM processes achieve their minimal memory footprint because they are managed directly by the Erlang VM, not the OS, and each process has its own isolated, dynamically growing heap, eliminating shared memory overhead and 'stop-the-world' garbage collection pauses.
- Millions of Concurrent Agents: BEAM's Footprint Unleashes Scale: The minuscule memory footprint of BEAM processes is a cornerstone for its ability to handle massive concurrency; for instance, WhatsApp famously leveraged BEAM to manage 2 million active connections per server.
Sources
Open the full topic