[erlang-questions] Update on sharing constant data locally by reference rather than by copy?

Bjorn Gustavsson <>
Sat Mar 28 08:21:20 CET 2009


On Sat, Mar 28, 2009 at 4:08 AM, Matthew Dempsky <> wrote:
> On Thu, Mar 19, 2009 at 3:13 AM, Richard Carlsson <> wrote:
>> As far as I know, these constants will not be copied to the private
>> heaps of the processes.
>
> You're talking about current Erlang releases, right?  How does that
> work with module reloading?  E.g., if foo:bar/0 returns a constant
> complex data structure and the result is not copied into the calling
> process's private heap, what happens when a module is purged while a
> process is still holding onto a reference to the data structure?

The data will be copied to the heap of each process that has a reference
to the data before the module is purged.

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list