<div dir="ltr">Hey all, I've been having an issue with erlang crashing due to an out-of-memory error. I'm pretty sure the reason is that I'm looking up, updating, then writing back a fairly large dict in a mnesia transaction, and doing that many times for many different dicts. Each dict may contain thousands of 30 character string keys along with float values. My rough calculations say that each dict may be on the order of a couple megabytes, maybe approaching 10M given the indexing overhead of the dict structure. And since all the value copying happens within a transaction, there's a lot of memory being used. Here's the basic transaction function I'm doing:<div>
<div><br></div><div>T = fun(Term, Key) -></div><div>         [Dict1] = mnesia:read(Table, Term),</div><div><div>         Dict2 = dict:store(Key, Val, Dict1),</div><div>         ok = write_val(Table, Term, Dict2)</div><div>
     end.</div><div><br></div><div>Any thoughts, alternative approaches? Because of erlang's single assignment, I'm thinking maybe what I need is a kind of "binary dict", something where the whole structure is not copied when a small part changes, and still provides very quick value lookup and key iteration. Does this sound feasible, any thoughts on how to implement it? Is there any existing code for something like this? Could I still store the binary in mnesia?</div>
<div><br></div><div>Thanks,</div><div>Jacob</div></div></div></div>