public
Created

  • Download Gist
gc_refc.erl
Erlang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-spec gc_count(non_neg_integer(), binary()) -> non_neg_integer().
gc_count(PreviousCounter, Bin) ->
case byte_size(Bin) of
N when N >= 64 -> % refc binary
Count = N + PreviousCounter
case NewCount >= ?THRESHOLD of
true ->
erlang:garbage_collect(),
0;
false ->
NewCount
end;
N -> % heap binary
PreviousCounter+N
end.

The variable 'Count' is unused.

The variable 'NewCount' is unbound.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.