Skip to content

Commit

Permalink
Add clearing of thread/fiber locals
Browse files Browse the repository at this point in the history
Avoid memory leaks where the thread/fiber pool store's every local seen.
  • Loading branch information
MattFenelon committed Sep 12, 2024
1 parent 9394ef4 commit 8a8bdae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/graphiti/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ def future_with_fiber_locals(*args)

result = yield(*args)

if execution_context_changed
thread_storage&.keys&.each { |key| Thread.current[key] = nil }
fiber_storage&.keys&.each { |key| Fiber[key] = nil }
end

result
end
end
Expand Down

0 comments on commit 8a8bdae

Please sign in to comment.