[erlang-questions] [eeps] New EEP: setrlimit(2) analogue for Erlang

Michael Truog mjtruog@REDACTED
Fri Feb 8 04:36:29 CET 2013


On 02/07/2013 07:27 PM, Björn-Egil Dahlberg wrote:
>
>
> 2013/2/8 <ok@REDACTED <mailto:ok@REDACTED>>
>
>     > An idea which seems like it should be included in this EEP, is simply a
>     > function to determine how much real memory is consumed by an erlang
>     > variable.
>
>     Given a language with immutable data structures and free sharing,
>     I am having a hard time trying to think what this might mean.
>     Consider as one of the *easy* cases
>
>         L0 = [],
>         L1 = [L0|L0],
>         ...
>         L99 = [L98|L98]
>
>     The amount of memory it really uses is just 99 cons cells,
>     presumably 198 words.  The amount that will be calculated
>     by a recursive sizer is about 2^99 (approximately).
>
>
> 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):
>
> Eshell V5.9  (abort with ^G)
> 1> A = {1,2,3}.
> {1,2,3}
> 2> B = [A|A].
> [{1,2,3}|{1,2,3}]
> 3> erts_debug:size(B).
> 6
> 4> erts_debug:flat_size(B).
> 10
>
That is what I was looking for.  Thanks!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130207/1f80607d/attachment.htm>


More information about the erlang-questions mailing list