Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’m out of my league so this may be dumb, but does any language or VM or whatnot have a combined system where each thread has its own heap, and you can talk by passing messages, but they also have a common heap for larger data that’s too expensive to pass around, but at the cost that you have to be much more careful with lifetimes or have to manage it manually or something?


In the Erlang VM, each Erlang "process" has its own garbage collected heap [1]. There's also an ETS module for more efficiently storing and sharing large amounts of data, but data stored in ETS is not automatically garbage collected [2].

[1] https://www.erlang.org/doc/apps/erts/garbagecollection [2] https://www.erlang.org/doc/man/ets.html


If you squint at it right you could say C works that way: you have many processes each with their own heap and they can pass messages, but if they want larger data that's too expensive to pass around you can use shared memory.


That’s just IPC, nothing inherent to C.


Sure, you can do this in a lot of languages. I gave C mainly because it's the "native language" of Unix.


I believe Nim works this way, among others.


I believe Erlang works this way.


Dart




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: