Memory Footprint: BEAM Processes vs. OS Threads
Erlang processes on BEAM are incredibly lightweight, typically starting at 2-3 KB, making them 500-1000 times smaller than traditional OS threads which often consume 1-2 MB of memory.
The top 3
- BEAM Processes: Kilobytes vs. OS Threads: Megabytes: A minimal BEAM process typically starts at around 2-3 KB, including its control block, stack, and heap. In stark contrast, a traditional OS thread, such as those in Java, often requires 1-2 MB for its stack space, making BEAM processes hundreds of times lighter in initial memory footprint.
- BEAM Processes: Hundreds of Bytes vs. OS Threads: Megabytes: A typical BEAM process can start with a memory footprint as low as ~270 bytes, whereas an operating system thread usually requires several megabytes, primarily for its stack and execution context.
- Memory Efficiency: Up to 10,000x Smaller Footprint: Each BEAM process consumes significantly less memory – often thousands of times less – than a typical OS thread, allowing for an incredibly higher density of concurrent operations on the same hardware.
Sources
Open the full topic