[erlang-questions] Tuple memory size
Fri Feb 20 16:30:28 CET 2009
In memory, is a tuple an array of pointers, or are the tuple and its
contents actually stored contiguously? In other words, if you have a
tuple that contains dozens of other tuples that contain integers, will
changing an element of the top-level tuple require a deep copy, or
will it just make a new tuple that points at mostly the same objects
as the old one?
I would assume that the tuple is an array of pointers, but the
efficiency guide says the size of a tuple is 2 words + the total sizes
of each stored element. That would imply that they are actually
stored contiguously; if it were pointers, the size should be 2 words +
1 word per element of the tuple, I would think.
More information about the erlang-questions