为什么使用erts_debug:size / 1原子的内存为零? [英] why the memory for atom is zero using erts_debug:size/1?

查看:120
本文介绍了为什么使用erts_debug:size / 1原子的内存为零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 erts_debug:size / 1 计算erlang VM中原子的内存,但是我发现输出为零。谁能解释原因?

I use erts_debug:size/1 to calculate the memory for atom in erlang VM, but i find that the output is zero. Who can explain the reason?

7> erts_debug:size(true).
0


推荐答案

原因是原子是与原子的数据一起插入原子表中,因此整个节点中只有一个原子副本。这意味着在您的数据中,原子只是原子表中的一个标记引用,不占用任何空间。因此大小为零。

The reason is that atoms are interned in the atom table together with the data for the atom so there is only one copy of an atom in the whole node. This means that in your data the atom is just a tagged reference in to the atom table and takes no space. Hence the size is zero.

所以它不是不一致或错误。

So it is not an inconsistency or bug.

这篇关于为什么使用erts_debug:size / 1原子的内存为零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆