[erlang-questions] : Tuple memory size

Raimo Niskanen <>
Tue Feb 24 18:24:43 CET 2009


On Tue, Feb 24, 2009 at 10:54:04AM -0600, tsuraan wrote:
> > The latter.
> 
> As a follow-up, is there a function that can be called to determine
> the amount of memory that is copied when sending a complex non-binary
> structure as a message between processes?  I've been using
> size(term_to_binary(Data)), which I think at least puts an upper bound
> on the size.  Is there a more accurate (i.e. correct) built-in
> function that finds the size of a data structure?

1> A = {1,2,3}.
{1,2,3}
2> erts_debug:size(A).    
4
3> erts_debug:flat_size(A).
4
4> erts_debug:size({A,A}).     
7
5> erts_debug:flat_size({A,A}).  
11

Size is in words.

> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list