The Erlang GC docs talk about how immediate terms do not use any heap space.
Terms are created on the heap by evaluating expressions. There are two major types of terms: immediate terms which require no heap space (small integers, atoms, pids, port ids etc) and cons or boxed terms (tuple, big num, binaries etc) that do require heap space. Immediate terms do not need any heap space because they are embedded into the containing structure.
However, there’s also this table which lists small ints as 1 word of memory. But if I run,
the result is 0. Similarly, if I check other immediate terms with that function, I end up getting n -1, where n is what appears in that table. The box terms seems to match up with the table.
So, I’m just wondering why the discrepancy?
Immediate terms do not need any heap space because they are embedded into the containing structure.
I take “containing structure” to be like a tuple, list etc. is that correct?