103
103
do_allow_garb() ->
104
104
%% The order of the following stuff is important!
105
105
Curr = val(latest_transient_decision),
106
Old = val(previous_transient_decisions),
107
Next = create_transient_decision(),
108
{Prev, ReallyOld} = sublist([Curr | Old], 10, []),
109
[?ets_delete_table(Tab) || Tab <- ReallyOld],
110
set(previous_transient_decisions, Prev),
111
set(latest_transient_decision, Next).
106
%% Don't garb small tables, they are created on every
107
%% dump_log and may be small (empty) for schema transactions
108
%% which are dumped twice
109
case ets:info(Curr, size) > 20 of
111
Old = val(previous_transient_decisions),
112
Next = create_transient_decision(),
113
{Prev, ReallyOld} = sublist([Curr | Old], 10, []),
114
[?ets_delete_table(Tab) || Tab <- ReallyOld],
115
set(previous_transient_decisions, Prev),
116
set(latest_transient_decision, Next);
113
121
sublist([H|R], N, Acc) when N > 0 ->
114
122
sublist(R, N-1, [H| Acc]);