diff --git a/internal/goofys.go b/internal/goofys.go index 469d7997..3dea2245 100644 --- a/internal/goofys.go +++ b/internal/goofys.go @@ -255,6 +255,11 @@ func newGoofys(ctx context.Context, bucket string, flags *FlagStorage, Mtime: now, } + if os.Getenv("GOGC") == "" { + // Set garbage collection ratio to 20 instead of 100 by default. + debug.SetGCPercent(20) + } + fs.bufferPool = NewBufferPool(int64(flags.MemoryLimit), uint64(flags.GCInterval) << 20) fs.bufferPool.FreeSomeCleanBuffers = func(size int64) (int64, bool) { return fs.FreeSomeCleanBuffers(size)