ets memory usage

Colm Dougan colm.dougan@REDACTED
Thu Aug 20 18:33:51 CEST 2009


Hi,

A question about ets memory usage :

Eshell V5.6.5  (abort with ^G)
1> Tab = ets:new(foo, [set]).
16397
2> lists:foreach(fun(I) -> ets:insert(Tab, {I, 0}) end, lists:seq(1, 1000000)).
ok
3> erlang:memory(ets).
48684012

So that looks like more than 40 bytes per entry.  Pretty expensive, no?

How about when the key is an md5sum :

Eshell V5.6.5  (abort with ^G)
1> Tab = ets:new(foo, [set]).
16397
2>  lists:foreach(fun(I) -> ets:insert(Tab, {erlang:md5(<<I:32>>), 0})
end, lists:seq(1, 1000000)).
ok
3> erlang:memory(ets).
72684940

So that is an additional 32 bytes per entry for an md5sum key instead
of a (4 byte?) integer key.

For a 30GB cache we would need about 7 million index entries which
would minimally take up


More information about the erlang-questions mailing list