Dear list,<br><br>afaik garbage collection in erlang is per process, but if a process gets large, it is automatically switched over to a generational scheme. What is unclear to me is when the collection happens. Let me illustrate with a very simple example.<br>
<br><br>start() -><br> Var = [{one, 1}, {two, 2}, ...,{thousand, 1000}],<br> loop(Var).<br> <br>loop(Var) -><br> ...<br> other_stuff(Var).<br><br>other_stuff(Var) -><br> ...<br> NewVar = lists:keyreplace(one, 1, Var, {one, "one"}),<br>
do_some_other_stuff(NewVar).<br> <br>do_some_other_stuff(Var) -><br> ...,<br> loop(Var).<br><br><br>My question is: when will the original list be garbage collected? Only when this whole process exits? When we go back to loop/1? What if Var was quite big [or you had many of these processes] and you wanted to optimized memory management?<br>
<br>Any input welcome..<br><br>r.<br><br>