<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 02/07/2013 07:27 PM, Björn-Egil
Dahlberg wrote:<br>
</div>
<blockquote
cite="mid:CAMjYFoOsvWB6mw9u6oYi6YgaCNs5_p1R3ZaG5MQwRqTGJxx8pg@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=ISO-8859-1">
<br>
<br>
<div class="gmail_quote">2013/2/8 <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:ok@cs.otago.ac.nz"
target="_blank">ok@cs.otago.ac.nz</a>></span><br>
<blockquote class="gmail_quote">
<div class="im">> An idea which seems like it should be
included in this EEP, is simply a<br>
> function to determine how much real memory is consumed
by an erlang<br>
> variable.<br>
<br>
</div>
Given a language with immutable data structures and free
sharing,<br>
I am having a hard time trying to think what this might mean.<br>
Consider as one of the *easy* cases<br>
<br>
L0 = [],<br>
L1 = [L0|L0],<br>
...<br>
L99 = [L98|L98]<br>
<br>
The amount of memory it really uses is just 99 cons cells,<br>
presumably 198 words. The amount that will be calculated<br>
by a recursive sizer is about 2^99 (approximately).<br>
</blockquote>
<div><br>
</div>
<div>Btw, If its just the matter of memory then there exists
erts_debug:size/1 and erts_debug:flat_size/1 (calculates
number of words):</div>
<div><br>
</div>
<div>
<div>Eshell V5.9 (abort with ^G)</div>
<div>1> A = {1,2,3}.</div>
<div>{1,2,3}</div>
<div>2> B = [A|A].</div>
<div>[{1,2,3}|{1,2,3}]</div>
<div>3> erts_debug:size(B).</div>
<div>
6</div>
<div>4> erts_debug:flat_size(B).</div>
<div>10</div>
</div>
<div><br>
</div>
</div>
</blockquote>
That is what I was looking for. Thanks!<br>
<br>
<br>
</body>
</html>