erts_debug:flat_size/1 wrong?

Michael Truog <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
Hi,

I have been attempting to compare the output of erts_debug:flat_size/1 
to the memory info at 
http://www.erlang.org/doc/efficiency_guide/advanced.html#id68923 and the 
results show that each term's size is off-by-one (at least for pids 
local/remote, refs local/remote, floats, integers, bignums, binaries and 
atoms).  I know the function is experimental, but this is a bug, right?  
The problem affects top-level terms and nested terms, so it is likely to 
understate the memory with large terms.  I wanted to make sure the 
memory info (in the efficiency guide) was accurate (it seems like it 
is).  I was testing with R16B03 on 64bits.

For example:
1> erts_debug:flat_size(576460752303423488).
2
2> erts_debug:flat_size(576460752303423487).
0
3> erts_debug:flat_size(undefined).
0
4> erts_debug:flat_size([]).
0
5> erts_debug:flat_size([undefined]).
2
% 1 word for each element in the list * 2 elements including []
6> erts_debug:flat_size(erlang:make_ref()).
3
7> erts_debug:flat_size(erlang:self()).
0
8> erts_debug:flat_size(1.0).
2

Thanks,
Michael
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.