repository: MasterIndex.ListPacks / Index.EachByPack allow earlier GC
Allow earlier garbage collection of some of the intermediate data structures.
This commit is contained in:
parent
0d9ac78437
commit
6ff9517e45
2 changed files with 4 additions and 0 deletions
|
@ -294,6 +294,8 @@ func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-
|
|||
result.Blobs = append(result.Blobs, idx.toPackedBlob(e, restic.BlobType(typ)).Blob)
|
||||
}
|
||||
}
|
||||
// allow GC once entry is no longer necessary
|
||||
byPack[packID] = nil
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
|
|
|
@ -458,6 +458,8 @@ func (mi *MasterIndex) ListPacks(ctx context.Context, packs restic.IDSet) <-chan
|
|||
|
||||
// pass on packs
|
||||
for packID, pbs := range packBlob {
|
||||
// allow GC
|
||||
packBlob[packID] = nil
|
||||
select {
|
||||
case out <- restic.PackBlobs{PackID: packID, Blobs: pbs}:
|
||||
case <-ctx.Done():
|
||||
|
|
Loading…
Reference in a new issue