[erlang-questions] simple question about list memory consumption

Francesco Mazzoli <>
Fri Jul 6 16:09:12 CEST 2012


At Fri, 06 Jul 2012 16:02:07 +0200,
Richard Carlsson wrote:
> Because all data is tagged.

OK.

> Simple - there's a difference between "tagged" and "boxed". Boxed means 
> the first word is a pointer (also tagged) to a location on the heap 
> where the real data is stored. An "immediate" like an integer is just 
> that first word, with a couple of bits used as tags.

I know that, the thing I was pointing out is that we need some additional space
to accommodate the tag as well, while people in this thread were accounting for
pointers only.

What I did not realise is that

> The two least significant bits are used for tagging as they are always 0 for a
> pointer to word aligned data.

Which makes it possible to include the tag in the word.

--
Francesco * Often in error, never in doubt



More information about the erlang-questions mailing list