Skip to content

Commit

Permalink
Also run Go garbage collection as part of Usage.Reduce.
Browse files Browse the repository at this point in the history
The `Usage.Reduce` RPC's promise is to reclaim as much Sentry memory as
possible and to give it back to the host.
Seems like running Go GC should be part of that.

PiperOrigin-RevId: 547312564
  • Loading branch information
EtiennePerot authored and gvisor-bot committed Jul 11, 2023
1 parent f8c4846 commit f921958
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/sentry/control/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ func (u *Usage) Reduce(opts *UsageReduceOpts, out *UsageReduceOutput) error {
if opts.Wait {
mf.WaitForEvictions()
}
// Also reduce Sentry memory usage by garbage-collecting now.
runtime.GC()
return nil
}

Expand Down

0 comments on commit f921958

Please sign in to comment.