2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

repository: trigger GC after loading the index

Loading the index requires some scratch space, thus make sure that this
memory does not factor into the targeted gc memory usage limit.
This commit is contained in:
Michael Eischer 2023-06-02 21:56:14 +02:00
parent f1b73c9301
commit eef0ee7a85

View File

@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os"
"runtime"
"sort"
"sync"
@ -601,6 +602,9 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
return err
}
// Trigger GC to reset garbage collection threshold
runtime.GC()
if r.cfg.Version < 2 {
// sanity check
ctx, cancel := context.WithCancel(ctx)