Skip to content

Commit

Permalink
Force garbage collection on remote gc
Browse files Browse the repository at this point in the history
Instead of waiting for it to eventually trigger.
  • Loading branch information
josevalim authored Aug 12, 2024
1 parent 5bdbec7 commit 4be28ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/explorer/remote/holder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ defmodule Explorer.Remote.Holder do
def handle_info({:gc, ref, pid}, state) do
refs = pop_from_list(state.refs, ref, pid)
pids = pop_from_list(state.pids, pid, ref)
:erlang.garbage_collect()
noreply_or_stop(%{state | pids: pids, refs: refs})
end

Expand All @@ -53,6 +54,7 @@ defmodule Explorer.Remote.Holder do
def handle_info({:DOWN, _, _, pid, _}, state) do
{pid_refs, pids} = Map.pop(state.pids, pid, [])
refs = Enum.reduce(pid_refs, state.refs, &pop_from_list(&2, &1, pid))
:erlang.garbage_collect()
noreply_or_stop(%{state | pids: pids, refs: refs})
end

Expand Down

0 comments on commit 4be28ce

Please sign in to comment.