6 ms·
This is incorrect. Functional languages are usually really good at data sharing since they promote immutability. When messages are sent to a process, the data i
by dudul 5y ago
This is incorrect. Functional languages are usually really good at data sharing since they promote immutability. When messages are sent to a process, the data is shared as much as possible to avoid duplication.
- toast0 5y agoUnless you do exciting things with NIFs, Erlang can't share any data except for the binary storage for RefC binaries. When you send a message, all the Erlang terms are copied for the new process, but for a RefC binary, that means a new ProcBin that references the same binary storage, not a copy of the binary storage. This copying isn't memory efficient and may not be CPU efficient, but along with immutability, it makes garbage collection simple, fast, and independent per process.
- deleted 5y ago[deleted]
- ramchip 5y agoErlang doesn't share data between processes by default (except large ref-counted binaries) because it would cause GC pauses to be global, rather than per-process.
- di4na 5y agoNot only that, the original reason was that it makes crashing and concurrency far easier. I suppose crashing is a kind of GC