Also run Go garbage collection as part of Usage.Reduce.

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
This commit is contained in:
Etienne Perot
2023-07-11 15:22:27 -07:00
committed by gVisor bot
parent f8c4846f21
commit f9219588c6
+2
View File
@@ -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
}