[erlang-questions] Data locality and the Erlang Runtime
James Hague
james.hague@REDACTED
Wed Dec 11 16:39:55 CET 2013
In C++, memory blocks can be allocated anywhere. If you malloc/new 50
blocks, they could be in 50 different parts of the address space. It
all depends on the memory allocator. In Erlang, and any language with
a compacting garbage collector, data is allocated sequentially. With a
small per-process heap, you might only have 4 or 16K of data, all
contained within a consecutive address space.
I wrote an action game in Erlang a few years ago, and if I mapped out
what all of the data looked like in memory it would have been a crazy,
tangled mess of pointers. The entire game ran at 60fps and only used a
small fraction of the available CPU (this was on a laptop from 2006).
James
More information about the erlang-questions
mailing list