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:
parent
f1b73c9301
commit
eef0ee7a85
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -601,6 +602,9 @@ func (r *Repository) LoadIndex(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trigger GC to reset garbage collection threshold
|
||||||
|
runtime.GC()
|
||||||
|
|
||||||
if r.cfg.Version < 2 {
|
if r.cfg.Version < 2 {
|
||||||
// sanity check
|
// sanity check
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user